2 ms·
A parser for what most people think of as XML can be fairly simple, certainly simpler than a performant or even just error-tolerant parser for HTML. Though Yxml
by mananaysiempre 5y ago
A parser for what most people think of as XML can be fairly simple, certainly simpler than a performant or even just error-tolerant parser for HTML. Though Yxml[1] is probably overdoing it, what with its lack of Unicode handling or tree construction, a couple of tens of kilobytes seems like the right order of magnitude to me. Heavier than JSON, but not drastically so, unless you decide you also need three types of schemas, two types of XPath, XSLT, etc. (the libxml2[2] approach).
The thing that requires the most bookkeeping is also the thing that nobody uses and not a lot of people even know about: a full textual macro system by the name of <!ENTITY ...> (the “internal DTD subset”), which a conformant XML processor is required to implement. (Not coincidentally, this is the part that the XML profile mandated by XMPP excludes.) There was a proposal to define something that excludes this part by the name of MicroXML[3], but it threw out compatibility by also excluding namespaces, and it doesn’t seem it actually went anywhere.
[1]: https://dev.yorhel.nl/yxml https://dev.yorhel.nl/yxml
[2]: http://www.xmlsoft.org/ http://www.xmlsoft.org/
[3]: https://www.w3.org/community/microxml/wiki/Main_Page https://www.w3.org/community/microxml/wiki/Main_Page