[jdom-interest] Formatting output
mike at saxonica.com
Sat Apr 7 06:00:08 PDT 2007
> Is there an authoritative reference on this?
In the [Infoset], a document information item must have at least one child,
its children must consist exclusively of element information items,
processing instruction information items and comment information items, and
exactly one of the children must be an element information item. This data
model is more permissive: a Document Node may be empty, it may have more
than one Element Node as a child, and it also permits Text Nodes as
> I ask because, unless I've long been mistaken, SAX suppresses
> such whitespace and always has.
Well, SAX doesn't support what you might call "XML fragments", and XDM does.
That's why you need to ask "which XML data model?".
Incidentally, I'm not sure where you found the statement that SAX parsers
won't report whitespace outside the document element. The ContentHandler
interface is certainly used for passing the structure of well-balanced
fragments as well as well-formed documents, and there's nothing in the
interface definition as far as I can see which says that this is not a valid
usage. This does cause some practical problems when you use JAXP to send
XSLT output to a SAXResult, because the XSLT output might have multiple
top-level elements, and some ContentHandlers can't cope with that.
More information about the jdom-interest