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

Top-level elements, non-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

Again, it does not make a difference, whether we use "qualified" or "unqualified" value. 3.3.2 XML Representation of Element Declaration Schema Components . Because these elements are top-level (they have "schema" as a parent), they must be from the "targetNamespace".

Valid document


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

Correct XML Schema (correct_0.xsd)


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

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

2. unqualified

The value of the "elementFormDefault" does not play any role, explanation see above.

Valid document


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

Correct XML Schema (correct_0.xsd)


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

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