Hi to all, thank you for your answers. I think it was a problem of both the connection of the XML-file with the Schema and the use of the setFeature() method. Now it works. Thank you.
Best regards, Mirko > -----Urspr�ngliche Nachricht----- > Von: Denny Vrandecic [mailto:[EMAIL PROTECTED] > Gesendet: Donnerstag, 11. Dezember 2003 14:00 > An: [EMAIL PROTECTED]; [EMAIL PROTECTED] > Betreff: Re: problem with getElementById() > > > Hi Mirko, > > just a little question, although I hope someone else will answer more > competently to your problem: > > are you sure you connected the XML-file properly with the Schema > file, i.e. > does the DOM-Parser have the ability to utilize the information > given in the > Schema? This doesn't show in your example code. > getElementsById can be used if and only if the parser knows about the > Schema, otherwise he has no idea of ID-type-attributes. > > Best regards, > Denny > > ----- Original Message ----- > From: "Mirko Braun" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, December 11, 2003 10:49 AM > Subject: problem with getElementById() > > > > > > 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] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
