Some thoughts on XML


Thread Starter

Zach Frey

Hi all. I've been lurking on the list for a few days, and have some comments on the XML discussion:

1) No, Microsoft doesn't "control" XML, the W3C does.

2) XML is not a format, it's a "meta-format." That is, it allows you to easily define new file/data formats.

3) Not all XML parsers are heavyweights. While the Xerces parser ( is a fine XML parser, it is more full-featured than lightweight. Two good lightweight parsers are James Clark's Expat parser ( and Daniel
Velliard's GNOME-XML h(ttp:// I've compiled Expat under VRTX before and found that the code size was approximately 120Kb.

4) There are two fairly standard APIs for XML, DOM (Document Object Model) and SAX (Simple API for XML). DOM is tree-based, and unless the implementation is highly clever, reads the entire document in to do processing. SAX is event-based, and treats the document as a stream, therefore only one XML element at a time needs to be read into memory. (Leaving the problem of remembering state information as an exercise for
the programmer ...)

In general, since I don't have a great love of lex and yacc (or flex and bison) and of writing parsers, if I had to create a file format, I'd rather simply define an XML document structure, choose an XML parser, and get on with using either the DOM or SAX API as appropriate. IMHO, of course.

Hope this helps ...

Zach Frey

LinuxPLC mailing list
[email protected]