Ski I don't see a namespace declaration in your xpath query. As far as I know you need to add this declaration for any namespaces that may be part of the query path. After the namespace declaration comes your query. Here is an example that includes two namespaces:
declare namespace m='http://eric.org/xml/baseData' declare namespace y='http://eric.org/xml/data'; $this/y:athlete_list/y:athlete/m:[EMAIL PROTECTED]'eotgpe'] The above string is the argument that I must supply to selectPath(String) to execute the query. Notice you also need the namespace declarations before the element names. I am not sure if there is any other way to do this. I have tried a number of variations but this is the only technique I have successfully used. Eric -----Original Message----- From: s.k.i. [mailto:[EMAIL PROTECTED] Sent: Saturday, August 30, 2008 9:50 AM To: user@xmlbeans.apache.org Subject: XmlBeans with XQuery Troubles I am having difficulty getting selectPath() and executeQuery() to work on a very simple xml example. The following small example sums up my problem. In the following code, I would expect 'result = test' to print. String doc = " <test/> "; query = "/a/test"; try{ XmlObject xml = XmlObject.Factory.parse(doc); XmlCursor cursor = xml.newCursor(); cursor.push(); cursor.selectPath(query); System.out.println("result = " +cursor.getTextValue()); }catch(Exception e){ System.out.println(e.getMessage()); } However, 'result =' indicating that selectPath() returns nothing. My runtime classpath contains the following xmlbeans and saxon related entries: xbean.jar jsr173_1.0_api.jar xbean-xpath.jar saxon9.jar saxon9-xqj.jar saxon9-dom.jar xmlbeans version is 2.4 saxon version is 9.0.0.4j Can someone give me some pointers as to what I may have done wrong or how I should go about resolving this issue? Thanks, ski -- View this message in context: http://www.nabble.com/XmlBeans-with-XQuery-Troubles-tp19235072p19235072.html Sent from the Xml Beans - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]