Re: elements with children vs typed-value

Per,

> <a>{$x}</a>
> would have to cbe implemented using element-complex-node if $x is a
> node, and using element-simple node if $x is a typed value.

This is right. Furthermore, the question of which constructor
to use when $x is a sequence can be easily determined:
element-simple-node can only be used when $x is a sequence of
simple-typed-values only, otherwise element-complex-node is to
be used.

The next version of the XQuery document will elaborate on the
use of the constructors. This will include spelling out which
constructor is to be used in which cases and how
element-complex-node is to be used when the content is a
heterogeneous sequence of simple-typed-values and nodes.

Marton


Per Bothner wrote:
> 
> > 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"
> 
> This is a helpful example.  What was not clear to me was how an
> element could have hoth children and a typed-value.  The suggestion
> to me was that element-complex-node could only create an element of
> complex type, in which case the typed-value is empty.  Perhaps it
> would be useful to clarify that element-complex-node even when the
> element has a smple type?
> 
> There is still the complication that:
> <a>{$x}</a>
> would have to cbe implemented using element-complex-node if $x is a
> node, and using element-simple node if $x is a typed value.  This is
> awkward enough, but what happens if $x is a sequence, containing both a
> node and a typed value?  I'm assuming in that case element-complex-node
> has to be used.
> --
>         --Per Bothner
> per@bothner.com   http://www.bothner.com/per/

Received on Tuesday, 5 March 2002 12:41:25 UTC