Quick Start Guide for Validation
This guide provides a brief, step-by-step introduction to document
validation. If you have ideas on improving this guide, please send your comments to sdvalidator@yahoo.com.
Step 1: Select File | New | SDD File. This will bring up
an empty SDD tab. Copy the sample SDD below and paste in into the
tab that you just openned.
<?sdd version="2" type="XML"?>
<document>1 [# docid={DIGIT}]
<head>1
<title>1{PCDATA} </title>
<author>+
<first>?{LOWERCASE}{UPPERCASE}{-} </first>
<middle>?{LOWERCASE}{UPPERCASE}{-} </middle>
<last>1{LOWERCASE}{UPPERCASE}{-} </last>
<contact>?
<email>* rgx="[a-z0-9\._\-]+@[a-z\.]+" </email>
<address>+
<street>1{PCDATA} </street>
<city>1{PCDATA} </city>
<state>1{LOWERCASE}{UPPERCASE}{-} </state>
<zipcode>1{DIGIT}{-} </zipcode>
<country>1{LOWERCASE}{UPPERCASE} </country>
</address>
</contact>
</author>
</head>
<body>1
block+
<section>?{PCDATA} </section>
<para>+{PCDATA} </para>
end_block
</body>
</document>
Step 2: Select SDD Development | Compile SDD. This will compile the SDD so that
the application can apply the SDD's rules and constraints to the
documents that you validate. The sample SDD is designed to validate
XML documents. You can tell this by checking the type attribute of the sdd
meta-tag at the top of the sdd. In this case the meta-tag reads:
<?sdd version="2" type="XML"?> .
Step 3: Select SDD Development | Make Template. This will create a
"blank" document (shown below) based on the SDD that was compiled in
the previous step.
<?xml version="1.0"?>
<document docid="">
<head>
<title></title>
<author>
<first></first>
<middle></middle>
<last></last>
<contact>
<email></email>
<address>
<street></street>
<city></city>
<state></state>
<zipcode></zipcode>
<country></country>
</address>
</contact>
</author>
</head>
<body>
<!-- start of block sequence -->
<section></section>
<para></para>
<!-- end of block sequence -->
</body>
</document>
Step 4: Select Validation | Validate | Current File. This will cause the application to validate the document in the tab that has focus. This document has a number of problems. The errors found will appear in a tab labeled Validation Errors at the bottom of the application. The first error explains that the value for the docid attribute is invalid and states what type of content would be valid. The other errors state that the contents of the respective tags are empty.
Errors for: untitled
-
Error Line: 2 Col: 19 The tag:
<document> contains a content error for attribute docid
Invalid Types Found: Empty Content Expecting: DIGIT
-
Error Line: 4 Col: 21 Empty
Content. The tag: <title> contains no content.
-
Error Line: 6 Col: 24 Empty
Content. The tag: <first> contains no content.
-
Error Line: 7 Col: 26 Empty
Content. The tag: <middle> contains no content.
-
Error Line: 8 Col: 22 Empty
Content. The tag: <last> contains no content.
-
Error Line: 10 Col: 27 Empty
Content. The tag: <email> contains no content.
-
Error Line: 12 Col: 32 Empty
Content. The tag: <street> contains no content.
-
Error Line: 13 Col: 28 Empty
Content. The tag: <city> contains no content.
-
Error Line: 14 Col: 30 Empty
Content. The tag: <state> contains no content.
-
Error Line: 15 Col: 34 Empty
Content. The tag: <zipcode> contains no content.
-
Error Line: 16 Col: 34 Empty
Content. The tag: <country> contains no content.
-
Error Line: 23 Col: 28 Empty
Content. The tag: <section> contains no content.
-
Error Line: 24 Col: 22 Empty
Content. The tag: <para> contains no content.
Step 5: Select Validation | Configuration.... Find the property Show Empty Content Errors and uncheck it. Now validate the document again. This time you will only see one error. The Validation Configuration dialog allows you to control various aspects of the validation process. See Validation Configuration for an explanation of the various settings.
Step 6: Turn Show Empty Content Errors back on and experiment with making changes to the document or the validation configuration. Try adding data or new tags or removing tags. The term PCDATA in the SDD means that any type of data is allowed.
|