XML DTD Validator rule
Use the XML DTD Validator rule to validate a request against an XML Document Type Definition (DTD) schema.
Schema
Validation Failed
error.
Policy execution order
The XML DTD Validator rule executes after the request is authenticated. You can use both the XML DTD Validator and XML XSD Validator rule policies concurrently as long as the schemas don't conflict.
Field | Description |
---|---|
When this rule should be applied | An expression that defines one or more conditions that must be
true for the rule to execute.
Example: The expression |
Edit DTD | Launches the XML editor which allows you to define XML.
The editor loads an existing XML document if defined previously.
The editor lets you save XML in SnapLogic's file system or import existing XML documents from it.
Default value: Empty XML file Example:
|
Hide/Render WhiteSpace | Formats XML with watermarked dots or plain white space between the characters. |
Format Code | Formats text in XML |
Status | Specifies whether the rule is enabled or disabled.
Default value: Enabled Example: Disabled |
Description |
Required. A brief description of this rule. Default value: Requests are being validated against the specified DTD Example: Task XML DTD Validator |
Usage Guidelines
Support for inline declared definitions
You can enter a schema by clicking Edit DTD to open the XML editor. If the editor is empty, the rule will evaluate the Document Type Definitions declared inline, as shown in the following example:
<?xml version="1.0"?>
<!DOCTYPE books [
<!ELEMENT books (book+)>
<!ELEMENT book (author, title, genre, price, pub_date, review+)>
<!ATTLIST book id CDATA #REQUIRED>
<!ELEMENT author (#PCDATA)>
<!ELEMENT title (#PCDATA)>
<!ELEMENT genre (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ELEMENT pub_date (#PCDATA)>
<!ELEMENT review (#PCDATA)>
]>
<books>
<book id="bk001">
<author>Famous Author</author>
<title>Computer Science</title>
<genre>Education</genre>
<price>100.00</price>
<pub_date>2000-10-01</pub_date>
<review>Test Review</review>
</book>
</books>
DTD Guidelines
The following guidelines apply DTD schemas entered into the editor and their HTTP clients making the request:
HTTP Clients are expected to provide a
<!DOCTYPE>
tag to indicate validation against Document Type Definitions. Without the tag, validation fails.The parameter just after
<!DOCTYPE>
is expected to be the same as the outermost tag in the XML. If not, validation fails.Externally referenced DTDs are declared with the following system callout:
SYSTEM "policy.dtd"
<!DOCTYPE outermost_object SYSTEM "external_reference.dtd">
is the standard callout format for specifying DTD validation against external references.For validation against the rule’s Document Type Definitions, HTTP clients are required to specify the
SYSTEM
declaration.As the API admin, you can instruct clients to use any
SYSTEM
parameter following the callout. Any value can be specified. See the"policy.dtd"
callout.Regardless of the value, the XML DTD Validator uses the definitions specified in the rule to validate external references.
<!DOCTYPE books SYSTEM "policy.dtd">
<books>
<book id="bk001">
...
</book>
</books>