- From: Nagy, Marton <MARTON.NAGY@saic.com>
- Date: Fri, 1 Mar 2002 02:52:11 -0500
- To: "'Per Bothner'" <per@bothner.com>
- Cc: "'query-comments'" <www-xml-query-comments@w3.org>
Per,
The data model specifies only one kind of element node.
The reason for the two constructors is the following:
Element-complex-node could be used to create a data model
representation of a source document or elements constructed
by XQuery that have no enclosed expressions.
Element-simple-node can be used to create a representation
of a constructed element containing enclosed expressions.
E.g. assuming that price is declared to be an element of type
xs:decimal, the first constructor would be used to create a
representation of the fragment <price>95.99</price> in a source
document, but the second constructor would be used to deal
with the XQuery constructor <price>{95.99}</price>.
In both cases the element constructed has
typed-value: simple-typed-value(95.99,xs:decimal)
children: text("95.99")
string-value: "95.99"
The first examples of 2.8.1 and 2.8.2 both use constants, i.e.
there is no expression enclosed in the xml tags. Hence they
can both be mapped to element-complex-node, although that
mapping is not spelled out precisely.
We plan to include a more precise mapping to the appropriate
constructors in the next version of the XQuery document, including
some resolutions to the currently open issues mentioned in the
Ed Notes.
children(<foo>{(3,4,5)}</foo>) returns text("3 4 5").
(Children can only return nodes, never simple typed values.)
This foo element can be constructed with element-simple-node,
since it contains enclosed expressions. Consequently the children
accessor returns a single text node containing the string
representation of the sequence of simple typed values, i.e.
"3 4 5". Supposedly the user plans to use something like this
with a schema that declares foo to be an element whose type is
list of integers.
I hope this explanation helps.
Best regards,
Marton Nagy
XML Query WG
> From: Per Bothner [mailto:per@bothner.com]
> Sent: Wednesday, February 27, 2002 12:39 AM
> To: www-xml-query-comments@w3.org
> Subject: elements with children vs typed-value
>
> [I gather, from the Ed Notes in 2.8.1 the Query Language draft of 12/20
> that these are known issue, but I'm hoping to get a feel for current
> thinking - and perhaps suggest my own.)
>
> From my reading of the XQuery Data Model document, there seems to be
> two
> distict non-overlapping kinds of element: Nodes that have children and
> nodes that have a typed-value. Specifically, the 'children' propery can
> never include a SimpleTypedValue and the 'typed-value' property can
> never include a Node. Correspondingly, the Data Model specifies two
> differet constructors: element-complex-node (takes a sequence of Nodes)
> and element-simple-node (takes a sequence of SimpleTypedValue).
>
> However, this seems inconsistent with the Language specification, where
> the specification of element constructors is unclear and does not
> indicate which of element-complex-node and element-simple-node is
> used when. Specifically, the first example in 2.8.2 uses "Crockett"
> and the content, which is a string, whlle the earlier example it claims
> to be the same presumably has Crockett as a text node.
>
> Specifically, what is the result of evaluating the following:
> children(<foo>{3,4,5}</foo>)
> The intuitive answer is that it should evaluate to the sequence
> (3,4,5)
> However, that is not allowed by the specification. It would require
> us to change the children property to a be an arbitrary sequence
> of simple values, or comment, element, process-instruction, or
> text nodes. I must confess that I don't have a good picture of
> the complications, including compatibility issues, but it does seem
> to be the most natural model. Altenatively, the result could be:
> text("3 4 5")
> or it could be the empty sequence (if element-simple-node is used
> to construct the node).
> --
> --Per Bothner
> per@bothner.com http://www.bothner.com/per/
>
Received on Friday, 1 March 2002 02:52:14 UTC