<< PreviousMarch 2005Next >>

Wednesday 30 March, 2005
#W3C Schema for xml:space

Look Ma! I wrote an XSD!

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
       elementFormDefault="qualified"
       targetNamespace="http://www.w3.org/XML/1998/namespace">

  <xs:attribute name="space">
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="preserve"/>
        <xs:enumeration value="default"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>
</xs:schema>

Stick it in a file call xmlspace.xsd and include it in your own schemas using

  <xs:import namespace="http://www.w3.org/XML/1998/namespace"
        schemaLocation="xmlspace.xsd"/>

  ...

  <xs:element name="myElement">
    <xs:complexType ...
      ...
      <xs:attribute ref="xml:space"/>
    </xs:complexType>
  </xs:element>


[Add a comment]