|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: PEReferences in comments
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 mailto:chris@h... http://www.hubick.com/ xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








