You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Giana Marco <m....@SynerGIS.co.at> on 2004/06/03 10:22:07 UTC

XMLBeans and Xpath

Hi all,

I am having trouble getting xpath queries to function using XMLBeans.
I have done searches to find solutions, but everything I have found does not seem to help.
I am using xmlbeans-1.0.2.

What I have done.

1. Build java classes from my schema. The schema has noNamespace, but I specified a package for it by using a xsdconfig file.
2. Have xbean.jar, jaxen-1.1-beta-2.jar, and xercesImpl.jar in my class path.

I can get the classes to be instantiated, and populated with info no problems.

I then try the following,

...
EDITGEOM[] editGeom = editlayers[0].getEDITGEOMArray();
...
String xpath = ".//EDITGEOM[@editlayername='ZONEN']";
editGeom = (EDITGEOM[])project[0].selectPath(xpath);

When it reaches the above selectPath function I get the following error,

java.lang.UnsupportedOperationException: This operation requires xqrl.jar
        at org.apache.xmlbeans.impl.store.XqrlDelegate.invoke(XqrlDelegate.java:70)
        at org.apache.xmlbeans.impl.store.XqrlDelegate.compilePath(XqrlDelegate.java:39)
        at org.apache.xmlbeans.impl.store.Path$XqrlPathImpl.create(Path.java:265)
        at org.apache.xmlbeans.impl.store.Path.getCompiledPath(Path.java:169)
        at org.apache.xmlbeans.impl.store.Path.getPath(Path.java:81)
        at org.apache.xmlbeans.impl.store.Path.getPath(Path.java:58)
        at org.apache.xmlbeans.impl.store.Path.select(Path.java:43)
        at org.apache.xmlbeans.impl.store.Cursor.selectPath(Cursor.java:2898)
        at org.apache.xmlbeans.impl.values.XmlObjectBase.selectPath(XmlObjectBase.java:396)
        at org.apache.xmlbeans.impl.values.XmlObjectBase.selectPath(XmlObjectBase.java:380)
        at test.main(test.java:49)

All the examples for xpath I have seen declare a name space in the expression as below, but I do not have a name space, is this an issue ?

String queryExpression =
    "declare namespace xq='http://openuri.org/bea/selectPath'" +
    "$this/xq:employees/xq:employee/xq:phone[contains(., '(206)')]"

Also from the archives (http://nagoya.apache.org/eyebrowse/ReadMsg?listName=xmlbeans-user@xml.apache.org&msgId=1166730)I 
it mentions that one requires the following jars in the classpath.
xbean_xpath.jar and jaxen.jar 

but where does one get xbean_xpath.jar from, is this valid for xmlbeans-1.0.2 ?

Regards

Marco Giana

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org