nestable C/C++ XML parser?

Lars Marius Garshol larsga at garshol.priv.no
Tue Dec 7 17:11:17 GMT 1999


* Paul Miller
|
| In other words, I'd like to start parsing, then branch to a function
| to handle a specific element, parsing in there until that element is
| closed, then fall back out of the function to continue parsing the
| rest of the document.

More people than you have been asking for this, but this is quite
simply not the way XML is meant to work. XML is a standardized syntax,
and because of that it makes no sense to let application developers do
part of the parsing, since they are likely to get parts of it wrong
and since the syntax is standardized there is no reason not to let the
parser handle it for you. (You would in any case only duplicate its
standard-decreed way of parsing.)

The only application I see for this sort of thing is to be able to
work around XML syntax rules, but once you do that your document is no
longer an XML document and you shouldn't pretend that it is, not even
to yourself. (Imagine what happens when an XML repository, XML editor,
XML browser or an XSLT engine tries to work with your "XML" document.)

In other words, when you find yourself doing this you should very
likely explain why to experienced XML developers and then ask them how
one usually handles this sort of thing _within_ XML, or else abandon
any pretense of using XML entirely.

--Lars M.


xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)





More information about the Xml-dev mailing list