CTreeCtrl and XML parsing
Hi,
Sorry to ask this question but I am not very good with recursion and XML
parsing.
So let's say I have a XML document defined as shown below :
<my-doc>
<characteristic type = "A">
<characteristic type = "B">
<parameter name = "nameC" value="val1" />
<parameter name = "nameD" value="val3" />
<parameter name = "nameE" value="val8" />
</characteristic>
</characteristic>
</my-doc>
I would like to display this document in a CTreeCtrl like this (I am
using - to represent spaces :
- my-doc
--- characteristic: type:A
------ characteristic: type:B
--------- parameter: nameC:val1
--------- parameter: nameC:val3
--------- parameter: nameC:val8
void CXmlTreeCtrl::ParseDocument(XMLNode xmlNode)
{
?????
}
Since I am using xmlParser I have access to the following method (I am
showing only the one that could be interesting for my pb ):
xmlNode.getName() //return current name
int nChildNode = xmlNode.nChildNode(); // return child number
xmlNode = xmlNode.getChildNode(int i = 0); // get child node
getAttributeName(k) //self explanatory
getAttributeValue(k) //self explanatory
xmlNode.nAttribute() // return attribute number
Actually when I try to insert items since I am recursing it seems that I
always insert items to the same root or somethig like that.
If someone could give me some tips or show me some sample code ...
Thanks