Hi to all,
i,m using the Xerces 2.3.0 to parse an XML-Document validating against a
Schema.
When using the method getElementById() to get a node referenced by an IDREF
(see code below)
a NULL-Pointer is given back. I'm sure that the ID is unique within the XML
Document.
Is their any special feature i have to set according to the use of Schema
and Xerces?
Can anybody help me? Thanks in advance.
Mirko
C++ code:
xercesc::DOMNode* pToDOMNode = oRevision.GetDOMNode();
xercesc::DOMNamedNodeMap* pToAttr = pToDOMNode->getAttributes();
xercesc::DOMNode* pToAuthorRef =
pToAttr->getNamedItem(xercesc::XMLString::transcode("AuthorRef"));
xercesc::DOMDocument* pToDocument = pToAuthorRef->getOwnerDocument();
xercesc::DOMElement* pToAuthor =
pToDocument->getElementById(pToAuthorRef->getNodeValue());
XML Document:
...
<AUTHOR id='_1'>
<SHORTNAME>Rz</SHORTNAME>
...
</AUTHOR>
...
<REVISION AuthorRef='_1'>
...
</REVISION>
XML Schema:
<xs:element name="AUTHOR">
<xs:complexType>
<xs:sequence>
<xs:element ref="SHORTNAME"/>
...
</xs:sequence>
<xs:attribute name="id" type="xs:ID" use="required"/>
</xs:complexType>
</xs:element>
...
<xs:element name="REVISION">
<xs:complexType>
<xs:sequence>
...
</xs:sequence>
<xs:attribute name="AuthorRef" type="xs:IDREF" use="required"/>
</xs:complexType>
</xs:element>
____________________________________
Mirko Braun
Automotive Electronics Tools
Softing AG
Richard-Reitzner-Allee 6
D-85540 Haar
Tel: +49 (0) 89 / 456 56 - 465
Fax: +49 (0) 89 / 456 56 - 499
mailto:[EMAIL PROTECTED]
http://www.softing.com
____________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]