02.06.2013 Views

XML Demystified

XML Demystified

XML Demystified

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

66<br />

<strong>XML</strong> Demystifi ed<br />

Number of<br />

Occurrences<br />

DTD minOccurs maxOccurs<br />

Zero to many * Zero Unbounded<br />

One to many + One Unbounded<br />

Zero or one ? Zero One<br />

Table 4-1 A Comparison Between minOccurs and maxOccurs<br />

If you don’t specify the minOccurs and maxOccurs attributes, the default value<br />

is one.<br />

With DTDs you learned how to reference multiple DTDs to form the definition<br />

of an <strong>XML</strong> document. An <strong>XML</strong> schema has a similar mechanism. You can use xs:<br />

include, which is basically the same as copying and pasting the referenced schema<br />

into the current schema. It doesn’t allow for any type of override of or alteration to<br />

the schema. The syntax looks like this:<br />

<br />

This tells the processor to include the customer.xsd definition. You can also use<br />

xs:redefine to include an external schema. xs:redefine allows you to alter the<br />

definitions in the remote file:<br />

<br />

… new definitions …<br />

<br />

Looking Ahead<br />

An <strong>XML</strong> schema is another way to describe the structure of an <strong>XML</strong> document. The<br />

<strong>XML</strong> schema defines the building blocks used to build the <strong>XML</strong> document, similar<br />

in concept to the document type definition (DTD).<br />

The <strong>XML</strong> schema language is used to create the <strong>XML</strong> schema. Each statement<br />

in the <strong>XML</strong> schema languge begins with

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!