- 98 -
We’ve prefixed all the mama:book elements with the mama prefix to tell the parser that
each component used is to be validated against the Mamazon.com schema.
2.75
We’re trying to illustrate that it is possible to use components described across many
different schemas and DTDs. Here, we’ve made up a mythical electronic commerce
organization that globally defines standards for currency units. While the mama:price
element is subject to validation against Mamazon’s schema, its currency attribute is
subject to validation against the E-commerce Organization’s schema.
Also, we should clarify that we’re assuming that the mama schema has a provision for
allowing a currency attribute in it whose definition comes from the E-commerce
Organization.
Here we’re using a book element whose definitions are described in the
http://NarnesAndBobel.com/book.dtd
file. When this element is parsed to check for
validity, the parser checks it against the type definitions expressed in that DTD. Thus, the
rest of the nab:book element’s structure—in this case its attributes—have to look exactly
as it would if it were working in isolation. We’ve prefixed all of the nab:book attributes with
the nab prefix to tell the parser that each component used is to be validated against the
NarnesAndBobel DTD.
You should buy the book from Mamazon.com
Wait a minute; these elements don’t have any prefixes! That’s fine. Remember that you
don’t
have
to validate everything. In this case, because this element is our own and we
have control over it, we decided not to validate it against anything. Our Result element is
not limited to only containing elements and attributes defined in the xmlns: attribute
values.