Elements and Nodes

The tags that make up XML have special names. They're called elements or nodes. The terms are more or less interchangeable (at least as far as we care about here). Let's use Example A-2 to take another look at the earlier example.

Example A-2. Another look
<?xml version="1.0" ?>
<customer_list>
    <customer number="050">
      <name>Cyndi Lauper</name>
      <customer_since year="1994" />
    </customer>
    <customer number="041">
      <name>Ozzy Osbourne</name>
      <customer_since year="2000" />
    </customer>
</customer_list>

The elements here are a number of customer_list, customer, name, and customer_since elements.

There are different types of elements. For example, any element that lives inside another element is called a child. In this example,

Get Advanced JavaScript™: Insights and Innovative Techniques now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.