29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The second part of our example shows several element declarations and two<br />

complex type definitions. The resulting schema is suited to represent a list of<br />

address records:<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

sequence is a reserved XSD keyword, defining the inner structure of a complex<br />

type (its content model). The other two XSD content models are choice and all.<br />

The type attribute is optional; it contains a reference to the type definition, which<br />

is either defined in an XSD file such as ours (for example,<br />

TestSchema:ZipCodeType) or a predefined standard data type (for example,<br />

string in the default XSD namespace).<br />

Assuming that the XSD defined above is saved as C:\temp\TestSchema.xsd. A<br />

sample XML file that validates against this schema is:<br />

<br />

<br />

<br />

x:Pesona Khayangan<br />

16411<br />

x:Jakarta<br />

<br />

<br />

x:Margonda Raya<br />

16423<br />

x:Depok<br />

Chapter 10. Working with XML 317

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

Saved successfully!

Ooh no, something went wrong!