The elementFormDefault
attribute must have the value
qualified to indicate that the locally defined elements -- i.e.,
TITLE
,
PHOTO
, COMPOSER
, PRODUCER
, PUBLISHER
,
YEAR
, and ARTIST
but not
SONG
-- are
qualified.
Globally defined elements such as SONG
are always
qualified by the target namespace
The default value of elementFormDefault
is unqualified.
This is exactly backwards from what it should be.
The default value of attributeFormDefault
is unqualified.
This is correct.
This mess was caused by an misguided attempt to make local elements and attributes equivalent.
Simplest approach: either don't use namespaces at all
or make sure all elements are namespace qualified and set
elementFormDefault="qualified"
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.cafeconleche.org/namespace/song" elementFormDefault="qualified" attributeFormDefault="unqualified" > <xsd:element name="SONG" type="SongType"/> <xsd:complexType name="SongType"> <xsd:sequence> <xsd:element name="TITLE" type="xsd:string"/> <xsd:element name="PHOTO" type="PhotoType" minOccurs="0"/> <xsd:element name="COMPOSER" type="xsd:string" maxOccurs="unbounded"/> <xsd:element name="PRODUCER" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="PUBLISHER" type="xsd:string" minOccurs="0"/> <xsd:element name="YEAR" type="xsd:gYear"/> <xsd:element name="ARTIST" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="PhotoType"> <xsd:complexContent> <xsd:restriction base="xsd:anyType"> <xsd:attribute name="ALT" type="xsd:string"/> <xsd:attribute name="WIDTH" type="xsd:nonNegativeInteger"/> <xsd:attribute name="HEIGHT" type="xsd:nonNegativeInteger"/> </xsd:restriction> </xsd:complexContent> </xsd:complexType> </xsd:schema>