ZVON > Tutorials > XML Schema and Relax NG Tutorial
Index | >> Example 1 / 4 << | Prev | Next |
Contents > elementFormDefault - elements > Top-level elements, null namespace

Top-level elements, null namespace

  1. qualified
  2. unqualified

Please, send all comments, bug-reports, and contributions to Jiri.Jirat@systinet.com. Thank you very much.

XML Schema keys: elementFormDefault

1. qualified

Let us imagine the simplest case. The attribute "elementFormDefault" is useless here, because it has no impact on top-level element definitions. ( 3.3.2 XML Representation of Element Declaration Schema Components ).

Valid document


<root xsi:noNamespaceSchemaLocation="correct_0.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > test </root>

Correct XML Schema (correct_0.xsd)


<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

  <xsd:element name="root" type="xsd:string"/>
</xsd:schema>

2. unqualified

The attribute "elementFormDefault" is useless here, so the result is the same as above.

Valid document


<root xsi:noNamespaceSchemaLocation="correct_0.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > test </root>

Correct XML Schema (correct_0.xsd)


<xsd:schema elementFormDefault="unqualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >

  <xsd:element name="root" type="xsd:string"/>
</xsd:schema>