[xquery-talk] How to retrieve Sequence of atomic values?
Torsten Grust
grust at in.tum.de
Mon Feb 20 15:47:54 PST 2006
On 2/20/06 3:42 PM, Daniel Pötzinger wrote with possible deletions:
> [...]
> How is it possible to handle an element:
> <test>1 2 3 4</test>
> as sequence of atomic types (xs:integer) in an XQuery?
You'll need a schema description for your element and then, in your
query, validate accordingly. The schema could contain a global element
declaration like:
<xs:element name="test">
<xs:simpleType>
<xs:list itemType="xs:integer"/>
</xs:simpleType>
</xs:element>
Your query would import this schema and then validate:
import schema ... ;
let $e := fn:data(validate { <test>1 2 3 4</test> })
return $e
The type of $e will be xs:integer* and $e[2] will evaluate to 2, for
example.
Cheers,
--Torsten
--
| Prof. Dr. Torsten Grust grust at in.tum.de |
| http://www-db.in.tum.de/~grust/ |
| Database Systems - Technische Universität München (Germany) |
More information about the talk
mailing list