O'Reilly logo

Real World XML by Steven Holzner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Child Element Lists

Besides using the content model of ANY, you can specify that the element you're declaring contains another element by giving the name of that element in parentheses, like this:

<?xml version = "1.0" standalone="yes"?> 
<!DOCTYPE DOCUMENT [
<!ELEMENT DOCUMENT (CUSTOMER)*>
]>
<DOCUMENT>
    .
    .
    .
</DOCUMENT>

In this case, I'm indicating that the root element, <DOCUMENT>, can contain any number (including zero) of <CUSTOMER> elements. (The way I specify that the <DOCUMENT> element can contain any number of <CUSTOMER> elements is with the asterisk after the parentheses, and we'll see how that works in a page or two.)

The <DOCUMENT> element can contain any number of <CUSTOMER> elements, so I can now add a <CUSTOMER> element to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required