OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: PEReferences in comments

[ Lists Home | Date Index | Thread Index ]
  • From: Chris Hubick <maillist@chris.hubick.com>
  • To: xml-dev@ic.ac.uk
  • Date: Thu, 6 Aug 1998 14:00:42 +0000 (GMT)

On Thu, 6 Aug 1998, John Cowan wrote:

> Oh, I don't know.  It's common for preprocessors to strip comments;
> the traditional C preprocessor did so, and so does the GNU C compiler
> working in preprocessor-only mode.

	No, I wan't to keep them in.  My parser's main selling/giving 
feature is that it gives a detailed breakdown of the file, based on the
grammar productions of the XML spec, right down to the character level.  I
think this will be very usefull in an authoring application, and I wan't
to keep the comments in.

> > My XMLSource object acts as a
> > buffer, and the parser moves forward and back in that buffer (array type
> > syntax) while trying to identify what is next in the file.
> Why backward and forward?   Pass through everything except a
> % or a <!--.  If it's a %, collect the following Name and the ;,
> look it up, pass through the value.  If it's a <!--, skip everything
> till -->.

	The lower lexical level can do as you say, but above that is the
grammar level.  I have a class for each production in the spec, each one
capable of taking an XMLSource object and parsing itself from the given
start index, generating events, and returning it's end index.  Each class 
throws an unmatched exception if whatever was at that point did not match
that grammar production, or a ProductionViolationException if it did
match (was that thing), but was not well formed.  So the parser figures
out what is where by asking an object to parse itself from the current
point, if it was that thing, fine, if not, discard it and try the next
possibility. As a result of this, it moves back and forth through the
XMLSource object as each XMLObject tries to parse itself, either
succeeding or failing.  If it succeeds, the XMLObjects can also build
themselves into a tree of the document.  It's very OO, and designed to
be clean and extensible rather than fast.  I am basically building
something that will make it easy for me to play with and learn XML and
related technologies, and that will also hopefully be of use to someone
out there, even if only as an educational tool.

Chris Hubick

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS