I need help

I am trying to walk through all the ChildNodes in a Node.
I can get to the ParentNode(properties) by using getElementsByTag, but i
can't seem to get a Node representation of the first child(propone) of the
ParantNode(properties). 

My XML Document looks like:
<?xml version='1.0' encoding='ascii'?>
<root>
        <surname>abcdef</surname>
        <properties>
                <propone>aaaa</propone>
                <proptwo>bbbb</proptwo>
        </properties>
</root>

code snippet:

                Parser.parse("c:/myxml.xml");   //option2:use file
                DOM_Document DomDoc = Parser.getDocument();
                DOM_NodeList NodeList =
DomDoc.getElementsByTagName("properties"); 
                int nElmts = NodeList.getLength();
                printf("\nnElmts\t%d\n",nElmts);
                DOM_Node Node = NodeList.item(0);
                if (Node.isNull())
                        return 0;
                unsigned int ln = 0;
                ln = NodeList.getLength();
                short NodeType = 0;
                NodeType = Node.getNodeType();
                
                DOMString dsVal0=Node.getNodeName();
                int ln0 = dsVal0.length();
                char *szVal0 = dsVal0.transcode();
                cout<<"\nNodeName of properties Node: "<<szVal0<<"\n";

                DOM_Node SubNode = Node.getFirstChild();
                DOMString dsVal1=SubNode.getNodeName();
                int ln1 = dsVal1.length();
                char *szVal1 = dsVal1.transcode();
                cout<<"\nNodeName of first property Node: "<<szVal1<<"\n";

Problem two
How do I get a list of all the nodes which are only one level under a
parentnode? If I do a ParentNode.getChildNodes, I get all the Nodes
including the ones which lies deeper than the nodes directly under the
parentnode. 

from
Rog


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

Reply via email to