XML Tree - Descendant
Any children that you have are your descendants. Any children that your children have are also your descendants. It doesn't matter how far down the family tree these children are; they will always be your descendants.- Element A is contained within element B.
Is an Element a Descendant?
If you are determining if one element is the descendant of another element, you will need to find the opening and closing tags of both elements to determine the relationship.We have highlighted inventory and lemonade in our lemonade.xml document; try to determine determine which element is the descendant.
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>
Here is a graphical representation of the relationship between inventory and lemonade. You can clearly see that lemonade is the descendant.
XML Tree:
Answer: price and amount.
0 comments:
Post a Comment