29.01.2013 Views

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

WebSphere Application Server - IBM Redbooks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

<br />

Note that the XSD file has to be accessible through HTTP. In the example,<br />

file:///C:/temp/TestSchema.xsd is a true URL pointing to a location. Namespaces<br />

such as http://www.ibm.com, on the other hand, just use the URI notation to be<br />

globally unique. Assuming that noProtocol://www.ibm.com is globally unique, it<br />

would be a valid namespace name as well.<br />

The syntax of the schema location attribute defined by XML standards is:<br />

xsi:schemaLocation="targetnamespaceURI locationURI"><br />

This is a quite tricky notation because it is not obvious that two different entities<br />

with a similar syntax but different semantics appear in the same attribute. Even<br />

worse, the locationURI is often not a full network address, but a simple local file<br />

name.<br />

Target namespace<br />

Several of the XSD elements introduced above can define a target namespace,<br />

which is either absent or a namespace name.<br />

The target namespace serves to identify the namespace within which the<br />

association between the element and its name exists. In the case of declarations,<br />

this association determines the namespace of the elements in XML files<br />

conforming to the schema. An XML file importing a schema must reference its<br />

target namespace in the schemaLocation attribute. Any mismatches between the<br />

target and the actual namespace of an element are reported as schema<br />

validation errors.<br />

In our example, the target namespace is http://www.ibm.com; it is defined in the<br />

XSD file and referenced twice in the XML file. Any mismatch between these three<br />

occurrences of the namespace lead to validation errors.<br />

10.1.7 Schema and style using XSLT and XSL<br />

The extensible style language (XSL) is a language defined by the W3C for<br />

expressing style sheets. It has three parts:<br />

► XSL transformations (XSLT), which is used for transforming XML documents.<br />

► The XML path language (XPath), which is a language used to access or refer<br />

to parts of an XML document.<br />

► XSL-FO, which is a vocabulary for specifying formatting semantics.<br />

A transformation in XSLT must be a well-formed document and must conform to<br />

the namespaces in XML, which can contain elements that may or may not be<br />

318 <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!