to the main page about the tutorial  THE XML REVOLUTION  -  TECHNOLOGIES FOR THE FUTURE WEB back up next

Inclusion and extension

DSD descriptions can consist of several XML documents that can be combined using import.

This makes it easy to

Example:

Assuming basic.dsd contains:

<dsd xmlns="http://www.brics.dk/DSD/2.0"
     xmlns:p="http://www.example.org/basic">

  <if><element name="p:widget"/>
    <declare>
      <contents>
        <repeat><element name="p:thingy"/></repeat>
      </contents>
      <attribute name="type"/>
    </declare>
  </if>
  ...
</dsd>

then we may use this schema in another schema:

...
<import href="basic.dsd"/>

<if>
  <and>
    <element name="p:widget"/>
    <attribute name="type"><string value="small"/></attribute>
  </and>

  <require><contents>
    <repeat max="7"><element name="p:thingy"/></repeat>
  </contents></require>
  <declare>
    <attribute name="style"/>
  </declare>
</if>
...

which means that a widget with type="small" can at most have 7 thingy child elements (restricting the basic definition), but additionally, it may have a style attribute (extending the basic definition).

back COPYRIGHT © 2000-2003 ANDERS MØLLER & MICHAEL I. SCHWARTZBACH next