Here is a simple example:

__ id_ref.xsd __
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns="http://sample.com/id_ref"; targetNamespace="http://sample.com/id_ref";
elementFormDefault="qualified" attributeFormDefault="unqualified">
  <xs:element name="root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="child" maxOccurs="1">
          <xs:complexType>
            <xs:attribute name="idref" type="xs:IDREF" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="id" type="xs:ID" />
    </xs:complexType>
  </xs:element>
</xs:schema>


__ id_ref.xml __
<root xmlns="http://sample.com/id_ref";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://sample.com/id_ref id_ref.xsd" id="root_id">
  <child idref="root_id" />
</root>


The following code returns empty arrays of XmlObjects when XPath is invoked
using the selectPath method:

RootDocument doc = RootDocument.Factory.parse(new File("id_ref.xml"));
XmlObject[] ids = doc.selectPath("id('root_id')");
XmlObject[] idrefs = doc.selectPath("idref('root_id')");

Is this the expected behavior using XMLBeans, or am I doing something wrong?

Thanks,
Coram
-- 
View this message in context: 
http://www.nabble.com/Support-for-id%28%29-and-idref%28%29-in-XPath-tf1957612.html#a5427138
Sent from the Xml Beans - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to