XML Tree - Child
When a man loves a woman very, very much, sometimes a kid shows up. This kid is the child of the man and woman.- Element A is contained within element B and is exactly one level below element B.
XML Code:
<a> <b> <c> <d> </d> </c> </b> </a>
- Element b is the child of element a.
- Element c is the child of element b.
- Element d is the child of element c.
Do You Know Where Your Children Are?
To find the children of element A, look between A's opening and closing tags. If there are elements which are only contained by element A, then they are A's children elements.Can you find the children elements of chips?
XML Code, lemonade.xml:
<inventory> <drink> <lemonade> <price>$2.50</price> <amount>20</amount> </lemonade> <pop> <price>$1.50</price> <amount>10</amount> </pop> </drink> <snack> <chips> <price>$4.50</price> <amount>60</amount> </chips> </snack> </inventory>
If it helps, you can always think of an XML document in a tree structure. Here, we have highlighted the children of chips in our lemonade.xml document.
0 comments:
Post a Comment