470,833 Members | 1,379 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

XQuery: How to retrieve Sequence of atomic values?

Hello List

Sorry if this question is too simple or unreleated, but I didn't found
an answer yet:

How is it possible to handle an element:
<test>1 2 3 4</test>
as sequence of atomic types (xs:integer) in an XQuery?
A cast to xs:integer* is not possible I think...

Thanks for Help

Daniel P.
Feb 20 '06 #1
1 1601


Daniel Poetzinger wrote:

How is it possible to handle an element:
<test>1 2 3 4</test>
as sequence of atomic types (xs:integer) in an XQuery?
A cast to xs:integer* is not possible I think...


You can tokenize the element content to a sequence of strings e.g.
tokenize(test, "\s+")
Documentation of the function is here
<http://www.w3.org/TR/xquery-operators/#func-tokenize>

Then doing a cast on any string in that sequence should do e.g.
for $s in tokenize(test, "\s+") return xs:integer($s)

That should do in XPath 2.0 and hopefully in XQuery 1.0 as those share
the data moel, functions and most expressions. But I haven't tried with
an XQuery processor.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Feb 20 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Jeff Kish | last post: by
1 post views Thread by FBS | last post: by
2 posts views Thread by Oscar Tuscon | last post: by
7 posts views Thread by urban.widmark | last post: by
2 posts views Thread by BK | last post: by
reply views Thread by Cameron.MacNeil.024 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.