Greets all,

I'm parsing an XML file and want t retrieve the data from a specific sub
tree. An example of the input follows:

<ProjectCollection>
    <Project>
        <Name>String</Name>
        <Description>String</Description>
        <Rate>3.14159265358979</Rate>
    </Project>
</ProjectCollection>

I used the DOMBuilder to parse the file and create the DOMDocument. Then
used getElementsByTagName() to retrieve all the "Project" element. When
trying to traverse the Project tree and output the Node values of "Name",
"Description", etc ... I get all empty strings.  Below is an extract of the
code i used to traverse the nodes of the project node. Variable projNodes is
a NodeList of "Project" elements.


 for(int i = 0; i < projNodes->getLength(); i++)
 {
    DOMNode *project = projNodes->item(i);
    DOMNode *child = project->getFirstChild();

    cout << child->getNodeValue();
 }

Any ideas folks as to why I wouldn't be getting the actual value of the Name
element instead of empty string??


.:. Keno .:.




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

Reply via email to