As stated in the error message, a <sequence>
element cannot contain any <attribute>
elements. Also, looking at e.g. these docs, <sequence>
shouldn't be directly nested in <element>
.
Also, your <sequence>
elements are lacking the xs
namespace prefix.
As for a solution, replace <sequence>
with <xs:complexType>
, and you should be fine.
EDIT: Actually, I'm not sure where your attributes are supposed to go:
- Are they supposed to be attributes of the type
ProjekteForms
? In that case, put them at the end of that complex type definition, together with yourid
attribute. - Or are they supposed to be attributes of your
<zhaw>
element? Your sample Xml suggest this, but in your XSD, your definition of<zhaw>
does not enclose the sequence with the attributes, as you are using the single-tag-form of the element. Replace<xs:element name="zhaw" type="xs:string"/>
with<xs:element name="zhaw">...</xs:element>
(with the complex type with attributes inside). Note that you have to omit thetype
attribute as a type is already specified by the enclosed<xs:complexType>
element. In order to allow text content, add the attributemixed="true"
to the<xs:complexType>
element.
The latter solution would look like this:
<xs:element name="zhaw">
<xs:complexType mixed="true">
<xs:attribute name="width" type="xs:integer"/>
<xs:attribute name="height" type="xs:integer"/>
</xs:complexType>
</xs:element>