I think I have figured out the problem. Since there is no text between <ServiceIndication></ServiceIndication> , no DOMText type node is created and hence the problem. Similar would happen in case of <ServiceIndication/>
thanks and regards Alhad [EMAIL PROTECTED] on 02/21/2003 08:36:57 PM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: (bcc: Alhad Wakankar/HSS) Subject: Problem with getFirstChild() / getNodeValue() ---- dumps core I have the following XML document. I firstly validate it against ShDataType.xsd and then start extracting data. -------------------------------------- <?xml version="1.0" encoding="UTF-8" ?> <Sh-Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ShDataType.xsd"> <PublicIdentifiers> <IMSPublicIdentity>test</IMSPublicIdentity> </PublicIdentifiers> <RepositoryData> <ServiceIndication>I Remove this later which causes core dump </ServiceIndication> </RepositoryData> </Sh-Data> -------------------------------------- When I extract data out of <ServiceIndication>I Remove this later which causes core dump</ServiceIndication> it works fine but when I remove the data effectively making the tags like this: <ServiceIndication></ServiceIndication> my code dumps core. Code : ...... ...... XercesDOMParser *gParser; DOMDocument *pDoc = gParser->adoptDocument(); DOMNodeList *pNodeList; pNodeList = pDoc->getElementsByTagName(XMLString::transcode("ServiceIndication")); if (pNodeList->getLength()) { const XMLCh *ptemp = pNodeList->item(0)->getFirstChild()->getNodeValue(); // !!!!!!!!!!!!!!!! The above statement dumps core. I think this happens beause getFirstChild() returns NULL.!!!!!!!!!!!!!!!!!!!!!!!!! <----- // Note that validation and parsing perfecting fine when there is data between the tags. pTempNodeValue = StrX(ptemp).localForm(); } ....... ....... Thanks in advance for hints/help. regards Alhad --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
att1.eml
Description: Binary data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]