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.

10.1.4 Validation<br />

A DTD identifies the root element of the document and may contain additional<br />

declarations. It must be the first item in the document after PIs and comments. A<br />

mix of external and internal DTD elements is possible.<br />

Here is an excerpt of the DTD of our example from Figure 10-1 on page 312:<br />

<br />

<br />

<br />

Because DTDs are superseded by XML schemas, we do not go into more detail<br />

here.<br />

A well-formed document is valid only if it contains a proper document type<br />

declaration and if the document obeys the constraints of that declaration.<br />

All valid documents are well formed; not all well-formed documents are valid.<br />

10.1.5 XML namespaces<br />

<strong>Application</strong>s associate the content of a document with its element names (tags).<br />

<strong>Application</strong>s might process two documents with elements using the same tag;<br />

however, it is possible that this tag has a different meaning in each of the two<br />

documents. Hence, the namespace concept is introduced in order to eliminate<br />

naming collisions.<br />

Tag names should be globally unique, but for performance reasons they also<br />

should be short; in order to resolve this conflict, the W3C namespace<br />

recommendation defines an attribute xmlns, which can amend any XML element.<br />

If it is present in an element, it identifies the namespace for this element.<br />

The xmlns attribute has the following syntax:<br />

xmlns=localQualifier:"globallyUniqueName"<br />

The globally unique name uses URI syntax, but it is not a real URI that can be<br />

accessed with a browser through HTTP. Predefined global names exist, for<br />

example, for the data types defined in XML schema and in the SOAP standard.<br />

In the following customer element definition, an accounting namespace is<br />

defined in order to be able to distinguish the element tags from those appearing<br />

in customer records created by other business applications:<br />

<br />

Corporation<br />

<br />

314 <strong>IBM</strong> <strong>WebSphere</strong> <strong>Application</strong> <strong>Server</strong> - Express V5.0.2 Developer Handbook

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

Saved successfully!

Ooh no, something went wrong!