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

Attribute and element defaults

Side-effect of validation:  insertion of default values

Each attribute and element declarations can contain a default="..." attribute.

(For some strange design reason, element defaults cannot contain markup.)


Example:

With a schema containing:

<element name="widget" default="no content explicitly provided">
  <complexType mixed="true">
    <attribute name="size" default="big"/>
  </complexType>
</element>

a schema processor will validate and transform:

<widget/>

into:

<widget size="big">no content explicitly provided</widget>

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