Hi everyone
I have a problem to generate correct treeview based on XML code as below. As you can see, there are two parents with same tag which is drink, and same tag name bottle for the grandchild.
The difference between each tag is their attribute where the first parent : drink, the attribute is VIP while the second parent : drink, the attribute is Commoners. The same goes to the grandchild where the different is the attribute. My question is, how can I write a program to differentiate the two parent / grandchild with same tag name but with different attribute.
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="SCL.xsl"?>
<drinks for="VIP" variety="2">
<Lemonade quantity="5">
<Sugar>5</Sugar>
<Cordial>5</Cordial>
</Lemonade>
<Syrup quantity ="5">
<Sugar>5</Sugar>
<Cordial>5</Cordial>
</Syrup>
</drinks>
<drinks for="Commoners" variety="1">
<Water quantity ="50">
<Bottle type="RO">
<Size>Small</Size>
<Quantity>10</Quantity>
</Bottle>
<Bottle type="RO">
<Size>Medium</Size>
<Quantity>10<Quantity>
</Bottle>
<Bottle type="RO">
<Size>Large</Size>
<Quantity>10</Quantity>
</Bottle>
<Bottle type="Filter">
<Size>Small</Size>
<Quantity>10</Quantity>
</Bottle>
<Bottle type="Filter">
<Size>Medium</Size>
<Quantity>10</Quantity>
</Bottle>
</Water>
</drinks>
I expect the tree to be like below
Drink
Leomanade
Sugar
Cordial
Syrup
Sugar
Cordial
Drink
Water
Bottle
Size
Quantity
Bottle
Size
Quantity
.....
.....
Please advice.