Document Structure Description

from Wikipedia, the free encyclopedia

Document Structure Description or DSD is a schema language that is used to describe classes of XML documents that all have the same syntactic requirements with regard to their structure and content. DSD was developed in cooperation with BRICS and AT&T Labs Research.

Development goals

The development goals of DSD were:

  • few and easy to understand language components (based on Boolean logic and regular expressions ) and to contain
  • easy to understand even for non-XML experts
  • To be more expressive than other document type definition languages ​​for most practical purposes

Concepts

The central concept of DSD is that every DSD scheme consists of a list of rules. A validating XML parser must process all rules for all elements of an XML document. The rules contain declare and require sections. Declare sections define which content (sub-elements and character data) and which attributes are permitted for the element. Require sections define extended restrictions on content and attributes. Rule conditions and extended restrictions are described using Boolean logic, while the values ​​of the attributes and the content of the elements are described using regular expressions.

example

An example of a DSD is:

<dsd xmlns="http://www.brics.dk/DSD/2.0"
 xmlns:my="http://example.com">

 <if><element name="my:foo"/>
  <declare>
   <attribute name="first"/>
   <attribute name="second"/>
   <contents>
    <element name="my:bar"/>
   </contents>
  </declare>
 </if>

 <if><element name="my:bar"/>
  <declare>
   <contents>
   </contents>
  </declare>
 </if>

</dsd>

The element "foo" in the XML namespace "http://example.com" can have the two attributes "first" and "second". The content of the "foo" element can only consist of the "bar" element, which it must contain. The "bar" element, in turn, must not contain any attributes, text or other sub-elements, so it must be empty.

An XML document that would be valid with regard to the DSD specification listed above would be e.g. B .:

<foo xmlns="http://example.com" second="2">
 <bar/>
</foo>

Web links

Individual evidence

  1. Anders Moller, Michael I. Schartzbach: Document Structure Description 2.0 . BRICS, 2003 (English)