You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Jones, Brian O." <br...@md.northgrum.com> on 2001/03/27 16:55:58 UTC

Parser problem

Hello all,

I am having no luck getting values from the children nodes.  Any suggestions
on what to do?



here is a code subset of what I did...
          DOM_Document doc = parser->getDocument();
          DOM_NodeList nodeList = doc.getElementsByTagName("Server");
          for(DOM_Node child=doc.getFirstChild(); child!=NULL;
child=child.getNextSibling() )
          {
             if (child.getNodeType()== DOM_Node::ELEMENT_NODE)
             {
                  
		int chTypeNode = child.getNodeType();
		DOMString chNodeName = child.getNodeName();
		char* chNodeNameVal = chNodeName.transcode();
                  DOM_Node children = doc.getFirstChild();
		DOMString chNdValue = children.getNodeValue();
		char* chNdNameVal = chNdValue.transcode();
                  //I want to print out each value in the children nodes
		cout << "\nValues are" << chNdNameVal << endl;
             }
             else
             {
               //do nothing
             }
          }


My XML file looks something like this...

<HWCONFIG>
    <Server>
        <HostName>
            PEPSI
        </HostName>
        <Channel>
            <Type>
                TNT
            </Type>
        </Channel>
    </Server>
</HWCONFIG>
I am trying to get the values PEPSI and TNT out. And having no luck

If you have any suggestions it would be greatly appreciated...
Thanks in Advance.


Brian Jones
Software Engineer
(Email) brian_o_jones@md.northgrum.com




---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org