You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xmlbeans-user@xml.apache.org by Giana Marco <m....@SynerGIS.co.at> on 2004/06/08 09:37:09 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




Re: XMLBeans and Xpath

Posted by nn <nn...@comcast.net>.
XMLBeans and XpathHi Giana,
I guess you need to create xbean_xpass.jar(you need to do ant xbean_xpass.jar??)
and add it to your class path.
nn

  ----- Original Message ----- 
  From: Giana Marco 
  To: xmlbeans-user@xml.apache.org 
  Sent: Tuesday, June 08, 2004 12:37 AM
  Subject: 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 




Re: XMLBeans and Xpath

Posted by nn <nn...@comcast.net>.
XMLBeans and XpathHi Giana,
I guess you need to create xbean_xpass.jar(you need to do ant xbean_xpass.jar??)
and add it to your class path.
nn

  ----- Original Message ----- 
  From: Giana Marco 
  To: xmlbeans-user@xml.apache.org 
  Sent: Tuesday, June 08, 2004 12:37 AM
  Subject: 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