Hi Radu, Yes im using xmlbeans 2.3.0, but not saxon 8.8 combo, im using saxon 9.0.0.4combo.
yes, i confirm scoreDoc = ScoreDocument.Factory.parse(new File("score.xml")) i tried with saxon 8.6.1 and now works fine. xmlbeans doest support saxon9 ? Regards On Thu, Apr 24, 2008 at 9:52 PM, Radu Preotiuc-Pietro <[EMAIL PROTECTED]> wrote: > Ah ok, sorry for not looking closer at your original example. > > However, I have just tried your exact code (and input document) and it > works for me... Are you using the XMLBeans 2.3.0/Saxon 8.8 combo? Can you > confirm that scoreDoc = XmlObject.Factory.parse(new File("score.xml")) ? > > Radu > > ------------------------------ > *From:* Gustavo Aquino [mailto:[EMAIL PROTECTED] > *Sent:* Sunday, April 20, 2008 1:41 PM > *To:* user@xmlbeans.apache.org > *Subject:* Re: XQuery > > Hi Radu, > The xquery with doc element, is used only in XMLSpy test, you can see in > block "CODE" i change the doc... per $this. > > the same query using saxon run all right but in xmlbeans this didn't work. > > Gustavo > > > On Thu, Apr 17, 2008 at 5:29 PM, Radu Preotiuc-Pietro <[EMAIL PROTECTED]> > wrote: > > > Query looks good. But when I see the "doc("score.xml")" call with a > > relative path in it, I'm thinking that is something that can cause problems. > > Also, please note that the free version of Saxon that XMLBeans uses doesn't > > support typed XQuery so you need to try XMLSpy without the Schema for a > > meaningful comparison. > > > > Radu > > > > ------------------------------ > > *From:* Gustavo Aquino [mailto:[EMAIL PROTECTED] > > *Sent:* Wednesday, April 16, 2008 2:17 PM > > *To:* user@xmlbeans.apache.org > > *Subject:* XQuery > > > > Hi, > > > > I'm trying to use XQuery in XMLBeans. > > > > Well using samples in XMLBeans package, all work fine, but when i write > > my XQuery it is not work. > > > > I wrote my XQuery and validate in XML Spy and all work fines, but when i > > put my xquery in XMLBeans this not return nothing. > > > > > > ---------------------------------------------------------------------------------------------------------------------------------------------- > > XQUERY ----- > > > > declare > > namespace n1='http://xxxxx.com.br/score/probability'; > > for $x in doc("score.xml")/n1:scores/score > > let $s := $x/name > > where $s = 'Score1' > > return $x > > ---------------------------------------------------------------------------------------------------------------------------------------------- > > XML ----- > > > > <?xml version="1.0" encoding="UTF-8"?> > > <n1:scores > > xsi:schemaLocation="http://xxxxx.com.br/score/probabilityscore_probability.xsd > > " xmlns:n1="http://xxxxx.com.br/score/probability" xmlns:xsi=" > > http://www.w3.org/2001/XMLSchema-instance"> > > <score> > > <class>0</class> > > <rating>String</rating> > > <probability>String</probability> > > <initial_score>0</initial_score> > > <end_score>0</end_score> > > <name>Score1</name> > > </score> > > <score> > > <class>0</class> > > <rating>String</rating> > > <probability>String</probability> > > <initial_score>0</initial_score> > > <end_score>0</end_score> > > <name>Score2</name> > > </score> > > <score> > > <class>0</class> > > <rating>String</rating> > > <probability>String</probability> > > <initial_score>0</initial_score> > > <end_score>0</end_score> > > <name>Score3</name> > > </score> > > </n1:scores> > > ---------------------------------------------------------------------------------------------------------------------------------------------- > > RETURN XML Spry----- > > <score xmlns:n1=http://xxxxx.com.br/score/probability xmlns:xsi=" > > http://www.w3.org/2001/XMLSchema-instance"><class>0</class><rating> > > String</rating><probability>String</probability><initial_score>0</ > > initial_score><end_score>0</end_score><name>Score1</name></score> > > > > ---------------------------------------------------------------------------------------------------------------------------------------------- > > CODE ----- > > > > > > > > String newQuery= > > "declare namespace n1='http://xxxxx.com.br/score/probability'; "+ > > "for $x in $this/n1:scores/score "+ > > "let $s := $x/name "+ > > "where $s = 'Score1' "+ > > "return $x"; > > > > XmlCursor scoreCursor = > > scoreDoc.newCursor(); > > scoreCursor.toNextToken(); > > XmlCursor resultCursor = scoreCursor.execQuery(newQuery); > > System.*out*.println("The query results : "); > > System.*out*.println(resultCursor.getObject().toString() + "\n"); > > ---------------------------------------------------------------------------------------------------------------------------------------------- > > RETURN PROGRAM----- > > > > > > The query results : > > > > <xml-fragment/> > > > > > > > > > > > > Thanks for any help. > > > > Gustavo > > > > > > > > > > Notice: This email message, together with any attachments, may contain > > information of BEA Systems, Inc., its subsidiaries and affiliated entities, > > that may be confidential, proprietary, copyrighted and/or legally > > privileged, and is intended solely for the use of the individual or entity > > named in this message. If you are not the intended recipient, and have > > received this message in error, please immediately return this by email and > > then delete it. > > > > Notice: This email message, together with any attachments, may contain > information of BEA Systems, Inc., its subsidiaries and affiliated entities, > that may be confidential, proprietary, copyrighted and/or legally > privileged, and is intended solely for the use of the individual or entity > named in this message. If you are not the intended recipient, and have > received this message in error, please immediately return this by email and > then delete it. >