Subject: Problem with getFirstChild() / getNodeValue() ---- dumps core
From: [email-masked]
To: [email-masked]
Date: Fri, 21 Feb 2003 20:36:57 +0530

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-masked]
For additional commands, e-mail: [email-masked]