|[ directory ]|
C.1 XML Core
XML namespaces provide a simple method for qualifying element and attribute names used in XML documents by associating them with namespaces identified by URI references. In the following example, the <book> tag and the <price> tag have the namespace prefixes order and edi, respectively. This means that they are associated with the namespaces identified by http://ecommerce.org/order and http://ecommerce.org/edi, respectively.
<?xml version="1.0"?> <order:book xmlns:order='http://ecommerce.org/order' xmlns:edi='http://ecommerce.org/edi'> <edi:price>14.95</edi:price> </order:book>
XML namespaces envision applications of XML where a single XML document may contain elements and attributes that are defined for and used by multiple software modules. In the previous example, the <book> tag and the <price> tag may be processed by different software modules.
The namespace specification is a W3C Recommendation and is widely used in a lot of standards.
C.1.2 XML Fragment Interchange
The XML standard supports logical documents composed of possibly several entities. An application is often required to view or edit one or more of the entities or parts of entities rather than the entire document. The problem is how to provide to the application of such a fragment the appropriate information about the context that fragment had in the larger document that is not available to the application. XML Fragment Interchange addresses this issue.
For example, assume that an application needs to view and edit the second <book> element from the following document but has no interest in viewing and editing the first <book> element.
<?xml version='1.0'?> <list> <book> <author>H. Maruyama, K. Tamura, and N. Uramoto</author> <title>XML and Java: Developing Web Applications</title> </book> <book> <author>IBM TRL XML Team</author> <title>XML and Java, 2nd Edition</title> </book> </list>
Here is a fragment representing the second <book> element from the previous document:
<?xml version='1.0'?> <p:package xmlns:p="http://www.w3.org/2001/02/xml-package"> <p:fcs xmlns:f="http://www.w3.org/2001/02/xml-fragment"> <list> <book/> <p:fragbody/> </list> </p:fcs> <p:body> <book> <author>IBM TRL XML Team</author> <title>XML and Java, 2nd Edition</title> </book> </p:body> </p:package>
C.1.3 XML Inclusions
Many programming languages provide an inclusion mechanism to facilitate modularity. XML also often needs such a mechanism. XML Inclusions introduces a generic mechanism for merging XML documents (as represented by their information sets) for use by applications that need such a facility.
In the following example, an XML document contains an <xi:include> element that points to an external document named external.xml.
<?xml version='1.0'?> <document xmlns:xi="http://www.w3.org/1999/XML/xinclude"> <p>This is a document</p> <xi:include href="external.xml"/> </document>
Assume that the external document is the following:
<?xml version='1.0'?> <external> <p>This is an external document.</p> </external>
Then the XML document resulting from resolving inclusions on the previous document is the following document:
<?xml version='1.0'?> <document xmlns:xi="http://www.w3.org/1999/XML/xinclude"> <p>This is a document</p> <external> <p>This is an external document.</p> </external> </document>
C.1.4 XML Infoset
The XML 1.0 Recommendation describes the physical representation of XML documents. However, XML-based standards are usually defined at a higher, logical level: in other words, standards tend to refer to abstract objects like element or data rather than to the physical sequences of characters that match the XML 1.0 Recommendation's syntactic productions. XML Information Set describes these abstract XML objects and their properties.
|[ directory ]|