1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <!--Arbortext, Inc., 1988-2010, v.4002-->
|
---|
3 | <!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN"
|
---|
4 | "topic.dtd">
|
---|
5 | <?Pub Sty _display FontColor="red"?>
|
---|
6 | <topic id="xsreadme" xml:lang="en">
|
---|
7 | <title>DITA XML Schema Readme </title>
|
---|
8 | <shortdesc>This document described the release notes and usage of
|
---|
9 | the experimental DITA XML Schema on <tm tmclass="ibm"
|
---|
10 | tmowner="IBM Corporation" tmtype="reg" trademark="developerWorks">developerWorks</tm>.</shortdesc>
|
---|
11 | <body>
|
---|
12 | <note>This information is considered out of date. Since DITA 1.0,
|
---|
13 | the DITA Schemas have provided equivalent function to DTDs, and are
|
---|
14 | considered stable and reliable. For more recent information about
|
---|
15 | Schema design patterns, see <xref format="html"
|
---|
16 | href="http://docs.oasis-open.org/dita/v1.1/OS/archspec/schemamod.html"
|
---|
17 | scope="external">the DITA 1.1 Architectural Specification</xref>.</note>
|
---|
18 | <required-cleanup><p>This DITA release includes an implementation of the topic architecture in XML Schema. The DTDs are still the canonical representation of DITA. The design pattern for the DITA Schemas is based on the W3C XML Schema 1.0 Specification and may be subject to change in the future.</p><p>The specialization process and design pattern for the DITA XML Schema are still being developed and refined. As such, the specialization process stated below should not interpreted as "the definitive process", but simply one method to specialize information types and domains. </p><p>A public mailing/discussion list to support users of DITA is available at <xref
|
---|
19 | href="http://groups.yahoo.com/group/dita-users/" type="external">Yahoo!Groups 'dita-users'</xref></p><topic
|
---|
20 | id="xsusing">
|
---|
21 | <title>Using DITA XML Schemas</title>
|
---|
22 | <body>
|
---|
23 | <p>There are a number of tools available to create, validate, or transform DITA XML Schemas. Here is a small list:</p>
|
---|
24 | <ul>
|
---|
25 | <li><tm tmclass="ibm" tmowner="IBM Corporation" tmtype="reg"
|
---|
26 | trademark="WebSphere">WebSphere</tm> Studio Advanced Developer 5.1</li>
|
---|
27 | <li>Xerces 2.6.X</li>
|
---|
28 | <li>Saxon-SA 8.X</li>
|
---|
29 | </ul>
|
---|
30 | <p>You can invoke Xerces XML document validation using SAX or DOM via the command-line:</p>
|
---|
31 | <pre> java sax.Counter -v -s [xmlDocument] java dom.Counter -v -s
|
---|
32 | [xmlDocument]</pre>
|
---|
33 | </body>
|
---|
34 | </topic><topic id="xsinfo">
|
---|
35 | <title>Information for DITA XML Schema</title>
|
---|
36 | <body>
|
---|
37 | <p>The DITA XML Schema architecture attempts to follow the naming convention established in the current DITA DTD architecture. Each element has its own named content model, i.e., topic.class for the topic element. Attributes that have an enumerated list of values in the DTD have their own class too, such as importance-att.class for the attribute important. </p>
|
---|
38 | <ul>
|
---|
39 | <li>All the elements in the base topic module are global. This will allow any element to be specialized.</li>
|
---|
40 | <li>All the attributes are local to the element's content model, except for the class attribute.</li>
|
---|
41 | <li>All the parametric entities in the DTD are named element groups with the same name as the DTD, such as basic.ph and ph.cnt.</li>
|
---|
42 | <li>All elements in specialized schema module are declared globally as abstracted elements, except for the root element. The specialized element must also be declared locally in the derived content models.</li>
|
---|
43 | </ul>
|
---|
44 | <p>This version of the DITA XML Schema does not use W3C XML Schema inheritance to model the DITA Architecture. In previous attempts to use the more efficient inheritance model, various Schema processors have implemented the "particle restriction" rules inconsistently. In order to have the same functionality as substitutionGroups without inheritance, a new layer was added to the design pattern. </p>
|
---|
45 | </body>
|
---|
46 | </topic><topic id="xsspec">
|
---|
47 | <title>XML Schema Specialization</title>
|
---|
48 | <body>
|
---|
49 | <section> <title>Creating a New Information Type</title> <p>Here are some simple steps that will make specialization easier according to the present design pattern:</p> <ol>
|
---|
50 | <li>Create a new information type schema document.<p>This schema document is a shell for the new information type. In it one includes parent information types and existing or new domains.</p><ul>
|
---|
51 | <li>Copy the contents of the parent specialization into the new *.xsd file.</li>
|
---|
52 | <li>Add an include statement for the *.mod in the XML Schema document.<pre><xs:include schemaLocation="mySpec.mod" /></pre></li>
|
---|
53 | </ul></li>
|
---|
54 | <li>Create a new information type module. <ul>
|
---|
55 | <li>Create a new global element. </li>
|
---|
56 | </ul><ul>
|
---|
57 | <li>Create a new content model for the element. For most elements the following template will do.<pre> <xs:complexType name="myElement.class" mixed="true" >
|
---|
58 |
|
---|
59 | </xs:complexType></pre> </li>
|
---|
60 | </ul><ul>
|
---|
61 | <li>Copy the content of the parent element's content model–everything between the elements <xs:choice>, <xs:sequence>, or <xs:all>–into the new element's content model. For example:<pre> <xs:choice minOccurs="0" maxOccurs="unbounded">
|
---|
62 |
|
---|
63 | </xs:choice></pre></li>
|
---|
64 | <li>Modify the class attribute default value. <p><pre><xs:attribute
|
---|
65 | ref="class" default="- topic/ph mySpec/mySpecElement
|
---|
66 | "/> </pre>The class attribute value starts and ends with white space, and contains a list of blank-delimited values. Each value has two parts: The first part identifies a topic type, and the second part (after a /) identifies an element type. The class attribute must include a mapping for every topic type in the specialized type's ancestry, even those in which no element renaming occurred</p></li>
|
---|
67 | <li> <b>Optional: modify the element content model.</b> </li>
|
---|
68 | </ul></li>
|
---|
69 | <li>Create a new information type group document, for example, mySpec.grp .<p>This file is a new part of the specialization for this release. The main reason for this new file is to support mimic schema inheritance without using the inheritance model in W3C XML Schema 1.0 specification. The process is very similar to the DITA DTD design pattern. Each element has its owned named group content model.</p><p>Each information type has its own *.grp file. In it one defines a new group for each new specialized element in the information type. <b>More will be explained </b></p><p> <pre>
|
---|
70 | <xs:group name="myElement"> <xs:sequence>
|
---|
71 | <xs:element ref="myElement" /> </xs:sequence>
|
---|
72 | </xs:group></pre> </p></li>
|
---|
73 | <li>Create a new 'domains document' for the information type, for example meSpec_domains.mod .<p>A domain specialization 'domains document' lists the specialized elements provided by the domain for a base element. The 'domains document' is used to redefine the information type group document. For example: <pre><xs:redefine
|
---|
74 | schemaLocation="mySpec.grp" /> <xs:group
|
---|
75 | name="keyword"> <xs:choice> <xs:group
|
---|
76 | ref="keyword"/> <xs:group
|
---|
77 | ref="md-d-keyword" /> </xs:choice>
|
---|
78 | </xs:group></pre><b>balh</b></p></li>
|
---|
79 | </ol> </section>
|
---|
80 | <section> <title>Creating a new Domain</title> <ol>
|
---|
81 | <li>Create a new schema document for the new domain. For example, myDomain-domain.mod .<ul>
|
---|
82 | <li>Create a new global element. </li>
|
---|
83 | <li>Create a new content model for the element. For most elements the following template will do.<pre> <xs:complexType name="myDomainElement.class" mixed="true" >
|
---|
84 |
|
---|
85 | </xs:complexType></pre></li>
|
---|
86 | </ul><ul>
|
---|
87 | <li>Copy the content of the parent element's content model, every thing between the elements <xs:choice>, <xs:sequence>, or <xs:all>, into the new element's content model. For example:<pre> <xs:choice minOccurs="0" maxOccurs="unbounded">
|
---|
88 |
|
---|
89 | </xs:choice></pre></li>
|
---|
90 | </ul><ul>
|
---|
91 | <li>Create a named group that will contain the new domain elements that will be used.<p> <pre><xs:group name="md-d-pre"> <xs:choice>
|
---|
92 | <xs:element ref="myDomainElement"/> </xs:choice
|
---|
93 | > </xs:group ></pre> </p></li>
|
---|
94 | </ul></li>
|
---|
95 | <li>Modify the class attribute default value.<p><pre><xs:attribute
|
---|
96 | ref="class" default="+ topic/pre
|
---|
97 | md-d/myDomainElement "></pre>For a domain element, the value of the class attribute must start with a plus sign. Elements provided by domains should be qualified by the domain identifier.</p></li>
|
---|
98 | </ol> </section>
|
---|
99 | <section> <title>Integrating a Domain in an Information Type Shell Document</title> <p>There are two types of domain specializations which can be added to an information type: <ul>
|
---|
100 | <li>A new domain</li>
|
---|
101 | <li>A new domain specialized from an existing domain.</li>
|
---|
102 | </ul></p> <p>Each type domain specialization integrates slightly differently with the information type shell document. </p> <ol>
|
---|
103 | <li>Include the domain module in the information type shell document, for example mySpec.xsd .</li>
|
---|
104 | <li>Create a new 'domains document' for the information type, for example meSpec_domains.mod .<ul>
|
---|
105 | <li>If the domain to be added <u>is not</u> a specialization of another domain:<ol>
|
---|
106 | <li>Copy the contents from topic_domains.mod (or similar 'domains document' that already integrate domain of interest) into a new 'domains document'. For example, mySpec_domains.mod .</li>
|
---|
107 | <li>Add the named groups (md-d-pre) from the new domain to the appropriate named group in the 'domains document'.<pre><xs:redefine schemaLocation="mySpec.grp" />
|
---|
108 | <xs:group name="pre">
|
---|
109 | <xs:choice>
|
---|
110 | <xs:group ref="pre"/>
|
---|
111 | <xs:group ref="md-d-pre" />
|
---|
112 | </xs:choice>
|
---|
113 | </xs:group></pre></li>
|
---|
114 | </ol></li>
|
---|
115 | <li>If the domain to be added <u>is</u> a specialization of another domain:<ol>
|
---|
116 | <li>Create a new 'domains document' for the information type, for example mySpec_domains.mod .</li>
|
---|
117 | <li>Include the new 'domains document' in the information type shell document<pre><xs:include schemaLocation="mySpec_domains.mod" /></pre></li>
|
---|
118 | <li>Remove the topic_domains.mod (or relevant 'domains document') and parent domain from the information type shell document and copy the new 'domains document.</li>
|
---|
119 | <li>Use the redefine mechanism to add the new domain element to parent name group content model.<pre><xs:include schemaLocation="topic_domains.mod"/>
|
---|
120 | <xs:redefine schemaLocation="ui-domain.mod">
|
---|
121 | <xs:group name="ui-d-ph">
|
---|
122 | <xs:choice>
|
---|
123 | <xs:group ref="ui-d-ph"/>
|
---|
124 | <xs:group ref="md-d-mydomainelt" />
|
---|
125 | </xs:choice>
|
---|
126 | </xs:group>
|
---|
127 | </xs:redefine></pre></li>
|
---|
128 | </ol></li>
|
---|
129 | </ul></li>
|
---|
130 | </ol> </section>
|
---|
131 | </body>
|
---|
132 | </topic><topic id="xsjava">
|
---|
133 | <title>Validate XML Schema using <tm tmclass="special"
|
---|
134 | tmowner="Oracle and/or its affiliates" tmtype="tm" trademark="Java">Java</tm></title>
|
---|
135 | <body>
|
---|
136 | <section> <title>Using Sun <tm tmclass="special"
|
---|
137 | tmowner="Oracle and/or its affiliates" tmtype="tm" trademark="Java">Java</tm> Development Kit (JDK)1.4.X and Xerces 2.6.X</title> <p>The Sun JDK 1.4.X has a built-in XML parser as part of the distribution. It is called Crimson. Unfortunately, Sun's Crimson parser only supports DTD validation. </p> <p>Sun provides a mechanism to override the classes in the JDK. It's called the <xref
|
---|
138 | href="http://java.sun.com/j2se/1.4.1/docs/guide/standards/"
|
---|
139 | type="external">Endorsed Standards Override Mechanism</xref></p> <p>For example, copy a version of the xercesImpl.jar and xml-apis.jar to <java_home>/jre/lib/endorsed. Here <java-home> refers to the directory where the Sun JDK is installed. Check the Xerces version via the included Version application using the following command-line syntax.</p> <pre>java -Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser org.apache.xerces.impl.Version
|
---|
140 | </pre> <note>Java 2 Platform, Standard Edition (J2SE) 5.0 and IBM Developer Kit includes Xerces 2.6.2 as the built-in XML parser.</note> </section>
|
---|
141 | </body>
|
---|
142 | </topic><topic id="xsvalidate">
|
---|
143 | <title>Java Application - ValidateXMLDoc</title>
|
---|
144 | <body>
|
---|
145 | <p>You can use the Java application ValidateXMLDoc to validate an XML document using an external XML Schema. The XML parser must support <xref
|
---|
146 | href="http://java.sun.com/xml/jaxp/faq.html" type="external">JAXP 1.2.</xref>. In Xerces' case, version 2.6.x. For example:</p>
|
---|
147 | <pre>java ValidateXMLDoc ../DITA-XS-readme.xml -s ditabase.xsd Usage:
|
---|
148 | java ValidateXMLDoc xmlDoc [options]
|
---|
149 | -----------------------------------------------------------------------------------------------------------
|
---|
150 | The application will attempt to validate the instance document using
|
---|
151 | the DOCTYPE value by default. options: -s Validate the instance
|
---|
152 | document using the defined noNamespaceSchemaLocation value. [xmlSchema]
|
---|
153 | Validate instance document using an external XML Schema URI: The
|
---|
154 | location of an external no namespace XML Schema relative to the xml
|
---|
155 | document. This will override the DTD/XML Schema that is defined in the
|
---|
156 | XML document"
|
---|
157 | -----------------------------------------------------------------------------------------------------------</pre>
|
---|
158 | </body>
|
---|
159 | </topic><topic id="xstransform">
|
---|
160 | <title>Java Application - TransformUsingXMLSchema</title>
|
---|
161 | <body>
|
---|
162 | <p>The Java application TransformUsingXMLSchema is used to transform an XML document using XML Schema validation. Most transform engines use DTD validation by default to build an in-memory document. The transformation engines need explicit instruction to use XML Schema validation instead of DTDs. The xsi:noNamespaceSchemaLocation attribute must be specified in the XML document for the application to works as expected. For example:</p>
|
---|
163 | <pre>java TransformUsingXMLSchema ../lawnmower.xml
|
---|
164 | ../../xsl\topic2html.xsl ../lawnmower.html Usage: java
|
---|
165 | TransformUsingXMLSchema xmlDoc xsltDoc htmlDoc
|
---|
166 | -----------------------------------------------------------------------------------------------------------
|
---|
167 | xmlDoc: The external URI location of an XML document to transform
|
---|
168 | xmlSchema: The external URI location of an XSL stylesheet htmlDoc: The
|
---|
169 | external URI location to write the resultant HTML document
|
---|
170 | -----------------------------------------------------------------------------------------------------------</pre>
|
---|
171 | <note type="note">The implied value for the class attribute, defined in the schema, is necessary for DITA XSLT scripts to work properly. If you see no output, or text-only output, this is usually an indication that the class attribute's default value has not been provided during parsing. Use the normalize.xsl transform to check the output of the parser: if the class attribute is missing, or the value is not bounded at the end by a space, the transforms cannot do class-based matching properly. </note>
|
---|
172 | <lines> Eric Sirois <xref href="mailto:[email protected]"
|
---|
173 | type="external">[email protected]</xref> IBM Corporation</lines>
|
---|
174 | <p>Java is a registered trademark of Oracle and/or its affiliates.</p>
|
---|
175 | </body>
|
---|
176 | </topic></required-cleanup>
|
---|
177 | </body>
|
---|
178 | </topic><?Pub Caret -2?>
|
---|
179 | <?Pub *0000016858?>
|
---|