xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschlaefcke <cschlaef...@wms-network.de>
Subject net.sf.saxon.trans.DynamicError: Required item type of first operand of '/' is node()
Date Mon, 16 Jun 2008 09:30:58 GMT

Hi Folks,

I just started using the "selectPath" Function of XmlBeans with a
XPath-Expression and run into different problems.

I have a xml structure that can have arbitrary nestings of
categories/category elements (see further below). With my Xpath expression I
want to filter a node category with a certain default name and get all of
its child categories.

But all I get Is the above mentioned exception:
java.lang.RuntimeException: net.sf.saxon.trans.DynamicError: Required item
type of first operand of '/' is node(); supplied value has item type
java:org.apache.xmlbeans.impl.store.Xobj-DocumentXobj
[...]

I searched with google and espacially in this forum but could not find any
hint on this!

I use XmlBeans in combination with Spring and Maven. I have
xmlbeans.jar:2.30, xmlbeans-xpath.jar:2.3.0, saxon.jar:8.7 and
saxon-xpath.jar:8.7 in my classpath.

Thanks for any help!

Regards,

Christian

Here is the code that causes my problems:

        [...]
        String prefix = "declare namespace
my='http://www.my-namespace.com';";
        String xq = prefix + "$this//my:category/@default_name='Category
1'";
        myDocument.selectPath(xq);
        [...]

The underlying xml is a little complex and looks like this:

    <my:sites xmlns:my="http://www.my-namepace.com">
      <my:site default_name="My Test Site">
        <my:attributes>
          <my:attribute locale="de_DE">
            <my:name>_longDescription_</my:name>
            <my:value>Description of site</my:value>
          </my:attribute>
        </my:attributes>
        <my:categories>
          <my:category default_name="Root Category">
            <my:attributes/>
            <my:categories>
              <my:category default_name="Category 1">
                <my:attributes>
                  <my:attribute locale="de_DE">
                    <my:name>_longDescription_</my:name>
                    <my:value>Description of Category 1</my:value>
                  </my:attribute>
                </my:attributes>
                <my:categories>
                  <my:category default_name="Category 1">
                    <my:attributes>
                      <my:attribute locale="de_DE">
                        <my:name>_longDescription_</my:name>
                        <my:value>Description of Category 1</my:value>
                      </my:attribute>
                    </my:attributes>
                  </my:category>
                  <my:category default_name="Category 1.1">
                    <my:attributes>
                      <my:attribute locale="de_DE">
                        <my:name>_longDescription_</my:name>
                        <my:value>Description of Category 1</my:value>
                      </my:attribute>
                    </my:attributes>
                  </my:category>
                  <my:category default_name="Category 1.2">
                    <my:attributes>
                      <my:attribute locale="de_DE">
                        <my:name>_longDescription_</my:name>
                        <my:value>Description of Category 1</my:value>
                      </my:attribute>
                    </my:attributes>
                  </my:category>
                </my:categories>
              </my:category>
              <my:category default_name="Category 2">
                <my:attributes>
                  <my:attribute locale="de_DE">
                    <my:name>_longDescription_</my:name>
                    <my:value>Description of Category 1</my:value>
                  </my:attribute>
                </my:attributes>
              </my:category>
              <my:category default_name="Category 3">
                <my:attributes>
                  <my:attribute locale="de_DE">
                    <my:name>_longDescription_</my:name>
                    <my:value>Description of Category 1</my:value>
                  </my:attribute>
                </my:attributes>
              </my:category>
            </my:categories>
          </my:category>
        </my:categories>
      </my:site>
    </my:sites>

-- 
View this message in context: http://www.nabble.com/net.sf.saxon.trans.DynamicError%3A-Required-item-type-of-first-operand-of-%27-%27-is-node%28%29-tp17860904p17860904.html
Sent from the Xml Beans - User mailing list archive at Nabble.com.


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


Mime
View raw message