[XML-SIG] Sax2.FromXml 'feature'

Lars Marius Garshol larsga@garshol.priv.no
11 Sep 2000 10:52:20 +0200

* Alexandre Fayolle
| Now if I change the last line of the previous example to:
| fragment = Sax2.FromXml('<frag/><frag/>',document)
| I get an SAXParseException: Elements not allowed outside root element at 
| Unknown:1:12

As far as I can tell, this causes the DOM builder to hand the string
to xmlproc for parsing, and xmlproc correctly complains that this XML
document (it has no idea it is parsing only a fragment) contains
markup outside the root element (the first element). 

It would be very easy to add an option to xmlproc that would allow
clients to tell it that it is parsing XML document fragments. We could
also add this as a SAX 2.0 feature. However, this might open to abuse
and parsing of strings that are not well-formed XML. 

An alternative might be for this function to add a fake container
element around the string to avoid this problem. Opinions, anyone?

--Lars M.