Yana,

 

Thanks for your help. The current environment and querying XML by selectPath() could meet our requirement. I just study some features of XMLBeans introduced in the web site.

 

Thank you again

 

Guofeng

 


From: Yana Kadiyska [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 16, 2005 2:47 AM
To: [email protected]
Subject: RE: selectPath and executeQuery: the result is different, why?

 

Guofeng,

My aplogies – I spoke too soon – it appeared to me that you can type the result yourself but I’m wrong. I’ll investigate if there is a workaround on this, for now, consider that you can’t type the result.

 

P.S. The only supported version is saxon8.1.1, so no wonder saxon8-2 gives you that error.

 

Yana

 


From: Guofeng Zhang [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 14, 2005 9:24 PM
To: [email protected]
Subject: RE: selectPath and executeQuery: the result is different, why?

 

My environment:

xmlbeans-2.0.0-beta1, saxonb8-1-1, JDK 1.5.0.

 

The following code is changed according to your instruction:

        String nsText = "declare namespace po = 'http://openuri.org/easypo';";

        String pathText = ".//po:[EMAIL PROTECTED]'ss']";

        String queryText = nsText + pathText;

 

        XmlObject[] customers = (XmlObject[])poDoc.execQuery( queryText ) ;

        for ( int i = 0 ; i < customers.length ; i++ )

        {

        Customer typedObj = (Customer) customers[0].changeType ( Customer.type );

        System.out.println( "Customer address: " + typedObj.getAddress() ) ;

        }

The address returned is null.

 

I find that for saxonb8-2, if I use selectPath() in the above code, the code throws “Exception in thread "main" java.lang.NoSuchMethodError: net.sf.saxon.xpath.XPathEvaluator.setStaticContext(Lnet/sf/saxon/expr/StaticContext;)V” but for saxonb8-1-1, it works well.

 

If I use saxon saxonb8-4, the code throws “java.lang.RuntimeException: No query engine found”.

 

Thanks for your help.

 

Guofeng

 

 


From: Yana Kadiyska [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 15, 2005 3:40 AM
To: [email protected]
Subject: RE: selectPath and executeQuery: the result is different, why?

 

What version of the code are you working with – we have a test /xmlbeans/trunk/test/src/xmlcursor/xpath/complex/checkin/ContainerCommentTest.java that uses the $that variable and passes fine – I seem to remember there was a bug that was fixed a while ago regarding $that.

 

We currently do not type the result of XQuery – I think that will be hard to do but need to look into it further …If you need the result typed please open a bug and we’ll look into it more deeply. For now you can use .changeType to manually type the results:

 

XmlObject[] results =  o.execQuery(“…”);

MyType typedObj = (MyType) results[0].changeType ( MyType.type );

 

 

 


From: Guofeng Zhang [mailto:[EMAIL PROTECTED]
Sent: Monday, June 13, 2005 9:41 PM
To: [email protected]
Subject: selectPath and executeQuery: the result is different, why?

 

I use easypo sample to study how to use XPath to select XML according to the instruction in conSelectingXMLwithXQueryPathXPath.html

 

For the following query express,

        String pathText =xqNamesapce +  "$this//po:[EMAIL PROTECTED]'ss']";

        Customer[] customers = (Customer[])poDoc.selectPath( queryText ) ;

I got the following exception:

java.lang.RuntimeException: net.sf.saxon.xpath.StaticError: XPath syntax error at char 5 in {$this//po:customer}:

Variable $this has not been declared

 

If I change the express to (replace “$this” with “.”):

        String pathText =xqNamesapce +  ".//po:[EMAIL PROTECTED]'ss']";

The code works well.

 

If I use executeQuery() instead of selectPaht(), I find that I have to use “$$this” or “.” to replace “$this” in the above pathText string, or no result is found. I also find that the return type of the executeQuery() is XmlAnyTypeImpl, instead of CustomerImpl.

 

I do not know if I configure my runtime environment incorrectly or I misunderstand the content in conSelectingXMLwithXQueryPathXPath.html?

 

Thanks for your help very much.

 

Guofeng

 

 

 

--------------------------------------------------------------------------------

Join CEO Alfred Chuang and CTO Mark Carges on June 15 for a unique online 
event, giving you the first look at a new category of enterprise software 
built specifically for Service-Oriented Architecture (SOA).

Register Now.  It's Free!

http://www.bea.com/events/june15

Reply via email to