Bookmark and Share

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.

Advertise on

In XML, an element can have many or no children. Element A is the child of element B when:

  • Element A is contained within element B and is exactly one level below element B.

In other words, B is the parent of A. In this example XML document there are three child relationships. Can you find them?

XML Code:

  • 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:


price and amount are the children of chips.

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.

XML Tree:

Bookmark and Share

Download's XML Book

If you would rather download the PDF of this tutorial, check out our XML eBook from the store.

Found Something Wrong in this Lesson?

Report a Bug or Comment on This Lesson - Your input is what keeps Tizag improving with time!

Advertise Here

More Tutorials!
Microsoft Office Tutorials Artist Tutorials