Abstract
A new approach for combining multiple vocabularies is presented. Rather than creating a monolithic schema by combining the schemas for several markup vocabularies, this approach decomposes a document into pieces and then validates each piece against one of these schemas. One advantage of this approach is that it allows the combination of multiple schema languages such as W3C XML Schema and and RELAX NG. This approach is expected to result in an ISO standard, namely ISO/IEC JTC1 DSDL Part 4 Selection of Validation Candidates.
Keywords
Table of Contents
An important motivation for introducing namespaces to [Extensible Markup Language (XML) 1.0] is to combine markup from multiple vocabularies. However, [Namespaces in XML] provides unique names without addressing validation. Later, namespace-aware schema languages such as [RELAX NG] and [W3C XML Schema] have been developed. Schemas written in these languages can handle multi-namespace documents. Such schemas typically consist of schema modules, each of which is concentrated in on one or a few namespaces.
However, it is still difficult to express syntactic restrictions on the way multiple vocabularies are combined. For example, how do you combine schemas for [XHTML 2.0 (W3C Working Draft)], MathML, SVG, and RDF and further specify where in XHTML2 documents you allow MathML expressions, SVG graphics, and RDF metadata? First, it is not easy to understand all schemas and then slightly revise them. Second, different schemas may be described in different schema languages (most notably RDF Schema), and thus they cannot be combined by "include" or "import" mechanisms.
ISO/IEC JTC1 SC34 is developing a new standard for combining multiple vocabularies. This standard is ISO/IEC JTC1 Document Schema Definition Languages (DSDL) Part 4: Selection of Validation Candidates and is expected to reach the FCD status in the near future. Rather than creating a monolithic schema by combining the schemas for several markup vocabularies, DSDL Part 4 decomposes a document into pieces and then validates each piece against one of these schemas. One advantage of this approach is that it allows the combination of multiple schema languages such as W3C XML Schema and RELAX NG.
The example document shown in G.1 of [XForms 1.0 (W3C Proposed Recommendation)] is an HTML2 document containing XForms markup. Moreover, this document contains a model, which is represented by a user-defined namespace. A simplified version of this document is shown below. The namespaces http://www.w3.org/2002/06/xhtml2, http://www.w3.org/2002/xforms, and http://commerce.example.com/payment represent HTML2, XForms, and the user-defined model, respectively.
<?xml version="1.0" encoding="UTF-8"?>
<html
xmlns:my="http://commerce.example.com/payment"
xmlns:xforms="http://www.w3.org/2002/xforms"
xmlns="http://www.w3.org/2002/06/xhtml2">
<head>
<title xml:lang="fr">XForms en XHTML</title>
<xforms:model schema="payschema.xsd">
<xforms:instance>
<my:payment as="credit">
<my:cc />
<my:exp />
</my:payment>
</xforms:instance>
<xforms:submission
action="http://www.example.com/buy.rb"
method="post" />
...
</xforms:model>
</head>
<body>
...
<group xmlns="http://www.w3.org/2002/xforms">
<trigger>...</trigger>
<trigger>...</trigger>
</group>
<switch xmlns="http://www.w3.org/2002/xforms">
<case>...</case>
<case>...</case>
</switch>
...
</body>
</html>
As of this writing, the working draft for XHTML 2 uses RELAX NG, while the XForms PR uses W3C XML Schema. Since RELAX NG cannot import or include W3C XML Schema and vice versa, we cannot create a monolithic schema.
DSDL Part 4 is expected to allow this document to be validated against the XHTML2 RNG schema, the XForms WSD schema, and the user schema (payment.xsd). In fact, [Namespace Routing Language] already allows this validation. We only have to write a NRL schemas shown below. It combines xhtml2.rng (the RELAX NG schema for XHTML2), XForms-Schema.xsd (the W3C XML Schema schema for XForms), and payment.xsd.
<?xml version="1.0" encoding="UTF-8"?>
<rules startMode="root"
xmlns="http://www.thaiopensource.com/validate/nrl">
<mode name="root">
<namespace ns="http://www.w3.org/2002/06/xhtml2">
<validate schema="xhtml2.rng">
<context path="head" useMode="inHeader"/>
</validate>
</namespace>
<namespace ns="http://www.w3.org/2002/xforms">
<validate schema="XForms-Schema.xsd"/>
</namespace>
</mode>
<mode name="inHeader">
<namespace ns="http://www.w3.org/2002/xforms">
<validate schema="XForms-Schema.xsd"/>
</namespace>
<namespace ns="http://commerce.example.com/payment">
<validate schema="payment.xsd"/>
<attach/>
</namespace>
</mode>
</rules>
This approach was started by [RELAX Namespace]. It has been significantly extended by [Modular Namespaces] and then [Namespace Routing Language], both of which were developed by James Clark. [Namespace Switchboard](Rick Jelliffe) was an input to NRL.
At present, most schemas are small and thus can be captured without using this approach. There are some large schemas, but they typically predate namespaces (e.g., DocBook) and thus cannot use this approach. As a result, we do not have enough experiences in combining schemas.
However, the author believes that non-monolithic documents and schemas are highly important for the future of XML. In fact, the XHTML family is already a collection of large schemas. Feedbacks from authors of multi-namespace large schemas are highly important for ISO/IEC JTC1 SC34 to finish this standard.
I am grateful to Kohsuke Kawaguchi, Tomoharu Asami, James Clark, Rick Jelliffe, and Mimasa Ishikawa.
[Extensible Markup Language (XML) 1.0] http://www.w3.org/TR/REC-xml
[Namespaces in XML] http://www.w3.org/TR/REC-xml-names/
[RELAX NG] http://relaxng.org/
[W3C XML Schema] http://www.w3.org/TR/xmlschema-0/, http://www.w3.org/TR/xmlschema-1/, and http://www.w3.org/TR/xmlschema-2/
[Committee Draft of Document Schema Definition Languages (DSDL) -- Part 4: Selection of Validation Candidates] http://www.y12.doe.gov/sgml/sc34/document/0363.htm
[DSDL Web Site] http://www.dsdl.org
[RELAX Namespace] http://www.y-adagio.com/public/standards/iso_tr_relax_ns/dtr_22250-2.doc
[Modular Namespaces] http://www.thaiopensource.com/relaxng/mns.html
[Namespace Routing Language] http://www.thaiopensource.com/relaxng/nrl.html
[Namespace Switchboard] http://www.topologi.com/resources/NamespaceSwitchboard.html
[XHTML 2.0 (W3C Working Draft)] http://www.w3.org/TR/xhtml2
[XForms 1.0 (W3C Proposed Recommendation)] http://www.w3.org/TR/xforms/
![]() ![]() |
Design & Development by deepX Ltd. |