Hi,
have a look at DOMNodeIterator and DOMTreeWalker. They provide
easy recursive access to the tree.
> while (y < x) {
>
> cout << "child " << y << " is " <<
> XMLString::transcode(list->item(y)->getNodeName())<< endl;
>
> DOMNode * grandChild = list->item(y)->getFirstChild();
>
> if (!grandChild->hasChildNodes()){
> //this is where to get the child nodes, but so far I just get the
> same children again.
> //so I think there is a big error here
>
> DOMNode * grandChild2 = list->item(y)->getFirstChild();
I think you want to say
DOMNode *grandChild2 = grandChild->getFirstChild();
> cout << "Child " << y << " has a node value of " <<
> XMLString::transcode(grandchild->getNodeValue()) << endl;
> //then, more of the same to get the great Grandchildren....
>
> }
> y++;
> }
> So, how do I set it up recursively to get all the children of children?
Set up a recursive method or take a look at the NodeIterator/TreeWalker.
> Also, I haven't gotten attributes or no whitespace to work yet, so my
> document is still mushed all together.
Can you expand on what you are doing here?
Gareth
--
Gareth Reakes, Head of Product Development +44-1865-203192
DecisionSoft Limited http://www.decisionsoft.com
XML Development and Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]