faq-question/xsd
in your working area.concept.xsd
, conceptGrp.xsd
, and conceptMod.xsd
from the base DITA schema set to the faq-question/xsd
directory.faq-question.xsd
, faq-questionGrp.xsd
, and faq-questionMod.xsd
.catalog.xml
file from the dtd
directory into the xsd
directory.xsd/catalog.xml
and change it as follows:<public>
elements and change "public" to "uri" and the "publicId" attributes to "name".This is necessary because the Apache Xerces parser incorrectly uses public ID resolution to resolve XSD schema locations. It should use URI entries (because schema locations are URIs not entity references and therefore should be resolved through URI entries in catalogs). Other systems that use the catalog will likely do the correct thing and use URI entries to resolve schema locations. So you need both forms of entry.
If you want to cover all bases you can make yet another copy of the entries and change <public>
to <system>
and "publicId" to "systemId". That covers the case where a processor treats a schema location as a system ID rather than a URI. That would also be wrong but some systems may do it.
faq-question/catalog.xml
file, copy the <nextCatalog>
element and change "dtd" to "xsd" in the new copy, resulting in this catalog file:<?xml version="1.0" encoding="UTF-8"?> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public"> <nextCatalog catalog="dtd/catalog.xml"/> <nextCatalog catalog="xsd/catalog.xml"/> </catalog>
<faq-question>
element:<?xml version="1.0"?> <faq-question xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="xsd/faq-question.xsd" id="question-id"> ... </faq-question>
Where the value of the @xsi:noNamespaceSchemaLocation
reflects the appropriate relative URL to the faq-question.xsd
file.
The document should not be valid at this point because the faq-question.xsd
file is just an unmodified copy of the concept XSD shell.
faq-question.xsd
and modify it as follows:<!-- ================ TOPIC DOMAINS INLCUSION ===================== --> <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:highlightDomain.xsd:1.2"/> <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:utilitiesDomain.xsd:1.2"/> <!-- ================ CONCEPT GROUP DEFINITION===================== -->
faq-questionGrp.xsd
file:<!-- ================ CONCEPT GROUP DEFINITION===================== --> <xs:include schemaLocation="faq-questionGrp.xsd"/> <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:conceptGrp.xsd:1.2"/>
<xs:redefine>
element, delete all the groups except the groups for "ph" and "fig":<xs:redefine schemaLocation="urn:oasis:names:tc:dita:xsd:commonElementGrp.xsd:1.2"> <xs:group name="ph"> <xs:choice> <xs:group ref="ph"/> <xs:group ref="pr-d-ph" /> <xs:group ref="ui-d-ph" /> <xs:group ref="hi-d-ph" /> <xs:group ref="sw-d-ph" /> </xs:choice> </xs:group> <xs:group name="fig"> <xs:choice> <xs:group ref="fig"/> <xs:group ref="pr-d-fig"/> <xs:group ref="ut-d-fig" /> </xs:choice> </xs:group > </xs:redefine>
<xs:group name="ph"> <xs:choice> <xs:group ref="ph"/> <xs:group ref="hi-d-ph" /> </xs:choice> </xs:group>
<xs:group name="fig"> <xs:choice> <xs:group ref="fig"/> <xs:group ref="ut-d-fig" /> </xs:choice> </xs:group >
<xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:topicMod.xsd:1.2" /> <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:conceptMod.xsd:1.2" /> <xs:include schemaLocation="faq-questionMod.xsd" />
@domains
attribute to reflect the domains and topic types actually used:<xs:attributeGroup name="domains-att"> <xs:attribute name="domains" type="xs:string" default="(topic hi-d) (topic ut-d) (topic concept faq-question)"/> </xs:attributeGroup>
At this point, the test document is still not valid. When you validate it you should see messages about the schema containing two occurrences of global components (concept, conbody, etc.), since the faq-questionMod.xsd file is still just a copy of the conceptMod.xsd file.
faq-questionGrp.xsd
and modify it as follows:<?xml version="1.0" encoding="UTF-8"?> <!-- ============================================================= FAQ Question topic type element-type group definitions Copyright (c) 2010 Your Name Here ============================================================= --> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'> <xs:group name="faq-question"> <xs:sequence> <xs:choice> <xs:element ref="faq-question"/> </xs:choice> </xs:sequence> </xs:group> <xs:group name="faq-answer-details"> <xs:sequence> <xs:choice> <xs:element ref="faq-answer-details"/> </xs:choice> </xs:sequence> </xs:group> <xs:group name="faq-short-answer"> <xs:sequence> <xs:choice> <xs:element ref="faq-short-answer"/> </xs:choice> </xs:sequence> </xs:group> <xs:group name="faq-question-statement"> <xs:sequence> <xs:choice> <xs:element ref="faq-question-statement"/> </xs:choice> </xs:sequence> </xs:group> </xs:schema>
Validate the test document again. This time you should get messages about being unable to resolve the references to the FAQ-specific element types referenced from the groups you just created.
faq-questionMod.xsd
and modify it as follows:<xs:annotation>
element to add " faq-question" to the domains value string:<xs:annotation> <xs:appinfo> <dita:domainsModule xmlns:dita="http://dita.oasis-open.org/architecture/2005/" >(topic concept faq-question)</dita:domainsModule> </xs:appinfo> <xs:documentation> </xs:documentation> </xs:annotation>
This change changes all the building blocks for <concept>
and <conbody>
to their FAQ question equivalents. The trailing "." is essential because you do not want to change "concept" or "conbody" where it occurs in @class
attribute values.
@class
attribute, append " faq-question/faq-question " to the end of the default value.<faq-question>
. <xs:element name="faq-question"> <xs:annotation> <xs:documentation> The <<keyword>faq-question</keyword>> element is the top-level element for a topic that represents a single question/answer pair representing a single question in a set of frequently asked questions. </xs:documentation> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="faq-question.class"> <xs:attribute ref="class" default="- topic/topic concept/concept faq-question/faq-question "/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element>
<xs:element>
for "conbody" to reflect the <faq-answer-details>
, resulting in this element declaration:<xs:element name="faq-answer-details"> <xs:annotation> <xs:documentation> The <<keyword>faq-answer-details</keyword>> element is the main body-level element for an faq-question. It holds any additional details for the FAQ question. Note that the first paragraph of the question answer is always held in the the <keyword>faq-short-answer</keyword> element. </xs:documentation> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="faq-answer-details.class"> <xs:attribute ref="class" default="- topic/body concept/conbody faq-question/faq-answer-details "/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element>
<xs:group name="faq-question-info-types"> <xs:choice> <xs:group ref="info-types" /> <!-- Removed reference to concept topic type --> </xs:choice> </xs:group>
<faq-question>
:<xs:group name="faq-question.content"> <xs:sequence> <xs:sequence> <xs:group ref="faq-question-statement"/> <xs:group ref="titlealts" minOccurs="0"/> <xs:choice minOccurs="1"> <xs:group ref="faq-short-answer" /> <!-- Removed reference to abstract --> </xs:choice> <xs:group ref="prolog" minOccurs="0"/> <xs:group ref="faq-answer-details" minOccurs="0"/> <xs:group ref="related-links" minOccurs="0"/> <xs:group ref="faq-question-info-types" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:sequence> </xs:group>
<xs:element>
for "faq-answer-details" and rename it "faq-question-statement". Change "faq-answer-details" to "faq-question-statement" and change the @domains
attribute value to "- topic/title concept/title faq-question/faq-question-statement ":<xs:element name="faq-question-statement"> <xs:annotation> <xs:documentation> The <<keyword>faq-question-statement</keyword>> element holds the question part of the question/answer pair (it is the FAQ topic's title). </xs:documentation> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="faq-question-statement.class"> <xs:attribute ref="class" default="- topic/title concept/title faq-question/faq-question-statement "/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element>
<xs:element>
for "faq-answer-details" and rename it "faq-short-answer". Change "faq-answer-details" to "faq-short-answer" and change the @domains
attribute value to "- topic/shortdesc concept/shortdesc faq-question/faq-short-answer ":<xs:element name="faq-short-answer"> <xs:annotation> <xs:documentation> The <<keyword>faq-short-answer</keyword>> element holds the first or only paragraph of the answer. This is the short description for the topic. </xs:documentation> </xs:annotation> <xs:complexType> <xs:complexContent> <xs:extension base="faq-short-answer.class"> <xs:attribute ref="class" default="- topic/shortdesc concept/shortdesc faq-question/faq-short-answer "/> </xs:extension> </xs:complexContent> </xs:complexType> </xs:element>
commonElementMod.xsd
from the standard DITA schema distribution and find the <xs:complexType>
declaration for "title.class". Copy the complexType, title.content group, and title.attributes group and paste it into the faq-questionMod.xsd.<xs:complexType name="faq-question-statement.class" mixed="true"> <xs:sequence> <xs:group ref="faq-question-statement.content"/> </xs:sequence> <xs:attributeGroup ref="faq-question-statement.attributes"/> </xs:complexType> <xs:group name="faq-question-statement.content"> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="title.cnt" minOccurs="0"/> </xs:choice> </xs:sequence> </xs:group> <xs:attributeGroup name="faq-question-statement.attributes"> <xs:attribute name="outputclass" type="xs:string"/> <xs:attribute name="base" type="xs:string"/> <xs:attributeGroup ref="base-attribute-extensions"/> <xs:attributeGroup ref="id-atts"/> <xs:attributeGroup ref="localization-atts"/> <xs:attributeGroup ref="global-atts"/> </xs:attributeGroup>
commonElementMod.xsd
find the <xs:complexType>
declaration for "shortdesc.class". Copy the complexType, title.content group, and title.attributes group and paste it into the faq-questionMod.xsd.<xs:complexType name="faq-short-answer.class" mixed="true"> <xs:sequence> <xs:group ref="faq-short-answer.content"/> </xs:sequence> <xs:attributeGroup ref="faq-short-answer.attributes"/> </xs:complexType> <xs:group name="faq-short-answer.content"> <xs:sequence> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:group ref="title.cnt" minOccurs="0"/> <xs:group ref="draft-comment" minOccurs="0"/> </xs:choice> </xs:sequence> </xs:group> <xs:attributeGroup name="faq-short-answer.attributes"> <xs:attribute name="outputclass" type="xs:string"/> <xs:attributeGroup ref="univ-atts"/> <xs:attributeGroup ref="global-atts"/> </xs:attributeGroup>
At this point the new topic type declarations are correct but in order to make them usable you need to replace all the local URL references with the URNs defined in the entity resolution catalog.
If you have already packaged the DTD version of the module as a Toolkit plugin you can simply redeploy it in order to have the updated catalog for the XSD components hooked in. If you haven't packaged it as a Toolkit plugin, you should do so now.
@xsi:noNamespaceSchemaLocation
value to the URN you associated with the faq-question.xsd
file, e.g.:<faq-question xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:pubid:example.org:doctypes:dita:faq-question.xsd" id="question-id"> ... </faq-question>
Validate the document. Assuming that you've deployed the new catalog correctly or otherwise hooked up the catalog into your validation system, the document should be valid.
faq-question.xsd
and modify the references to the faq-questionGrp.xsd
and faq-questionMod.xsd
files to use the corresponding URNs from the entity resolution catalog:... <!-- ================ CONCEPT GROUP DEFINITION===================== --> <xs:include schemaLocation="urn:pubid:example.org:doctypes:dita:modules:entities:faq-questionGrp.xsd"/> <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:conceptGrp.xsd:1.2"/> ... <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:topicMod.xsd:1.2" /> <xs:include schemaLocation="urn:oasis:names:tc:dita:xsd:conceptMod.xsd:1.2" /> <xs:include schemaLocation="urn:pubid:example.org:doctypes:dita:modules:faq-questionMod.xsd" /> ...