I *think* what this boils down to is that the free version of Saxon
(which is what XMLBeans is using) does not support typing and so
getId()-type Xpaths cannot work.

Of course (before you rush out and buy Saxon :p) no one had the
non-opensource version to integrate XMLBeans with it so it will not work
at all probably.

I am not an expert in the area, so corrections are welcome, also if
someone has experience with Saxon outside of XMLBeans, it would be
interesting to know if that works.

Radu

-----Original Message-----
From: cbryant [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 20, 2006 6:02 PM
To: [email protected]
Subject: Re: Support for id() and idref() in XPath


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-tf19
57612.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]

_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

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

Reply via email to