How is it possible to make an XML Schema accept two attributes to an element?
For instance, in an XML-file it is stated:
<list1_City City="Newcastle" Year="1999">
....
....
....
....
</list1_City>
I've been trying to write the XSD like this:
<xs:element name="list1_City">
<xs:complexType>
<xs:attribute name="City" type="xs:string" use="required">
<xs:attribute name="Year" type="xs:integer" use="required">
....
....
....
....
</xs:attribute>
</xs:attribute>
</xs:complexType>
</xs:element>
I have also tried to group the attributes with .
Every time I try to validate it with XMLLINT it throws an error like this:
sample2.xsd:15: element attribute: Schemas parser error : Element '{http://www.w3.org/2001/XMLSchema}attribute': The content is not valid. Expected is (annotation?, simpleType?). WXS schema sample2.xsd failed to compile
Any ideas?
/Paul
Thank you Martin. It seems to have get passed those lines of validation, but it's quite complex since the element doesn't get closed until the end of the XML-file and there are many nested elements in between. So should all (attributes, complexType and element) become closed before all the nested elements (the ones marked .... .... .... ....) are taken care of in the schema? It seems as if I close the element with
</xs:element>
then how could the schema validate elements under
<list1_City City="Newcastle" Year="1999">, such as
<List2><list1_Year_Collection><list1_Year><matrix1>
<matrix1_Type_Collection>
...and so on....until it closes with
</list1_City>
?