Hi,

I have an XML file with the format looks like:
===================================
 <relation entry1="43" entry2="48" type="ECrel">
        <subtype name="compound" value="88"/>
    </relation>
===================================

I want to extract the "value" under the node "subtype" by using DOM, I've tried two methods but neither return a correct result:

method 1: get a DOMnode(let's call it nd) points to "relation", then call "nd2 = nd->getFirstChild();". The problem is that this nd2 has the type "TEXT NODE", so I can't use "getAttributes", and getTextContent() doesn't work as well.

method2:
subList = doc->getElementsByTagName(XMLString::transcode("subtype"));

This time subList->item(0) has the type "ELEMENT NODE", but surprisingly "subList->item(0)->getAttributes()->getLength()" returns 1 !!! and this only attribute is "name" ... I still cannot extract "value".

So what's wrong with these methods and what's the good way to get "value" from this file???

Thanks a lot! Please reply, if this message is not clear enough I can post my code in more detail......

Song


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



Reply via email to