Topic Constraint Module Step 5: Test the Document Type Shell
<topic>
document in the same directory as the document type shell DTD with this content:<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE topic SYSTEM "topic-with-highlight-constraint.dtd"> <topic id="topic-1"> <title>Test of Paragraph Constraint</title> <body> <p>Allowed: <i>i</i>, <b>b</b>, and <u>u</u>. Not allowed: <keyword>keyword</keyword>.</p> </body> </topic>
Validate this document. The validator should report that <keyword>
is not
allowed within <p>
, that only <b>
,
<i>
, and <u>
are allowed. In a DTD-aware editor,
you should also be able to inspect the content model to see that it only allows
<b>
, <i>
, and <u>
. Remove the
<keyword>
element and verify that the topic is then valid.
In an XML-aware editor you should be able to inspect the effective value of the
@domains
attribute to verify that the constraint module is properly
declared. If you apply the Toolkit to the topic and keep the temp directory, you can
look at the intermediate topic file generated by the Toolkit to see what it produced
for
the @domains
attribute.
If you have made any typing or copying errors in the DTD declarations the parser will tell you, although the errors are not always obvious from the messages provided by the parser.
You can now package the constraint as a Toolkit plugin and integrate it with your other shell document types. See Packaging Document Type Shells and Vocabulary Modules as Toolkit Plugins.