XML: Multiple roots + text content outside the root. Does anyone do it?

Posted by Jeffrey Sweeney on Programmers See other posts from Programmers or by Jeffrey Sweeney
Published on 2012-04-07T12:53:58Z Indexed on 2012/04/07 17:46 UTC
Read the original article Hit count: 366

Filed under:

I have another one of those "is it done in XML" questions (my last one about xml comments hasn't been answered if anyone has a good explanation)

I was just wondering if anyone, anywhere would:

  1. Use multiple root elements in an XML document
  2. Put text content outside of a root element

W3C discourages these practices, Javascript's DOMParser doesn't even allow these cases, and I can't think of one sane reason to do either of these things. However, I know how bizarre some implementations of XML have been, so I wouldn't be surprised.

Does anyone have any real world examples where this would be done? I will also accept an answer that specifies if other mainstream parsers allow doing either of these.

© Programmers or respective owner

Related posts about Xml