xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
Re: [XOM-interest] Unable to use fn: string funtion
- From: Elliotte Rusty Harold <elharo AT ibiblio.org>
- To: XOM API for Processing XML with Java <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] Unable to use fn: string funtion
- Date: Tue, 10 Jun 2014 08:48:27 -0700
I'm not sure what this XQueryUtil thing you're using is. I don't think it's
part of XOM.
Likely your problem is in the XQuery serialization, but it's been a while
since I looked at anything in XQuery in depth.
On Tue, Jun 10, 2014 at 3:41 AM, Lovenish Goyal <lovenishgoyal AT gmail.com>
wrote:
> I am trying to print some string as a xQuery output from java code but
> output is generating with some garbage/additional information.
>
> Java Code
>
> Nodes results = XQueryUtil.xquery(doc_from, query);
> String outPut = "";
> for (int i = 0; i < results.size(); i++) {
> outPut += results.get(i).toXML();
> }
> System.out.println("output: " + conditionIfElseOutput);
>
> XML file
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <bookstore>
>
> <book category="COOKING">
> <title lang="en">Everyday Italian</title>
> <author>Giada De Laurentiis</author>
> <year>2005</year>
> <price>30.00</price>
> </book>
>
> <book category="CHILDREN">
> <title lang="en">Harry Potter</title>
> <author>J K. Rowling</author>
> <year>2005</year>
> <price>29.99</price>
> </book>
>
> <book category="WEB">
> <title lang="en">XQuery Kick Start</title>
> <author>James McGovern</author>
> <author>Per Bothner</author>
> <author>Kurt Cagle</author>
> <author>James Linn</author>
> <author>Vaidyanathan Nagarajan</author>
> <year>2003</year>
> <price>49.99</price>
> </book>
>
> <book category="WEB">
> <title lang="en">Learning XML</title>
> <author>Erik T. Ray</author>
> <year>2003</year>
> <price>39.95</price>
> </book>
>
> </bookstore>
>
> xQuery:
>
> let $document := //bookstore
> for $x in $document/book
> return
> if ($x/price>30)
> then
> string(123)
> else ()
>
> Output:
>
> <item:atomic-value xmlns:item="http://dsd.lbl.gov/nux"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string">123</item:atomic-value><item:atomic-value
> xmlns:item="http://dsd.lbl.gov/nux"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:type="xs:string">123</item:atomic-value>
>
>
> Why is this happening? I am expecting that I should get 123... back.
>
>
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>
--
Elliotte Rusty Harold
elharo AT ibiblio.org
-
[XOM-interest] Unable to use fn: string funtion,
Lovenish Goyal, 06/10/2014
- Re: [XOM-interest] Unable to use fn: string funtion, Elliotte Rusty Harold, 06/10/2014
Archive powered by MHonArc 2.6.24.