Competition: fast XML parser for charset labelling

David Megginson david at
Sun Apr 11 00:27:13 BST 1999

Chris Lilley writes:

 > Competition, for all those XML coders with <i>copious free time</i>:
 > Write an incredibly small and fast special-purpose XML parser whose
 > purpose is to locate  and read the xml declaration; don't bother reading
 > any more of the file once this is found.
 > It should however cope with any well-formed XML instance.

Don't think you'd need much time -- if the document starts with the
characters "<?xml" it has an XML declaration, and if it doesn't, you
can stop reading.  The hardest part is figuring out an approximate
encoding in the first place so that you can read the first five
characters, but the XML REC already has algorithms that can help.

All the best,


David Megginson                 david at

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

More information about the Xml-dev mailing list