Re: Component interfaces

Jeni Tennison wrote:
 > Hi Erik,
 >
 >  >> (possibly document nodes containing only a text node child, though
 >  >> that might be bending it too much).
 >> Ouch. I don't think you will find that such a thing is allowed in any
 >> W3C spec.
 >
 > I might be misunderstanding, but I think XDM allows precisely this.
 > See [1] which says:
 >
 >   The children [of a document node] must consist exclusively of
 >   Element, Processing Instruction, Comment, and Text Nodes if it is
 >   not empty. Attribute, Namespace, and Document Nodes can never appear
 >   as children
 >
 > XPath 2.0 allows this because XPath 1.0 allowed it. XPath 1.0 allowed
 > it to support the creation of parsed entities [2] (and, indeed,
 > non-XML text documents) using XSLT.
 >
 > So to properly support XSLT and XQuery then it must be possible to
 > pass around document nodes that do not represent XML documents, such
 > as those that have a single text node as a child.

Interesting.

So if you follow the infoset, you do need at least one element. But if 
you follow the XDM, you do not.

However, if you follow the XDM, you have the concept of item anyway, 
which implies simple types, so you do not really have the need to 
encapsulate text data within a document element (although you could 
define a subset of the XDM that does not support simple types and forces 
the use of document nodes to encapsulate text, but I would not really 
see the point).

-Erik

Received on Monday, 16 January 2006 17:13:35 UTC