I have the following XSD:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="urn:com.xxxxx.xxx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:com.xxxxx.xxx">
<xsd:element name="Stuff_EXT" type="DT_Analyse_EXT"/>
<xsd:complexType name="Stuff_EXT">
<xsd:annotation>
<xsd:documentation xml:lang="EN">Data Type Response</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Res">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Loc" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="No" type="xsd:string"/>
<xsd:attribute name="TP" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="Results" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="C" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="Date" type="xsd:string"/>
<xsd:attribute name="Result" type="xsd:string"/>
<xsd:attribute name="Rel" type="xsd:string"/>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Detail" maxOccurs="unbounded">
<xsd:complexType>
<xsd:attribute name="Co" type="xsd:string"/>
<xsd:attribute name="Result" type="xsd:string"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
I try to use this within my Visual Studio 2010 Professional.
The VS tells me that the <xsd:complexType>
after the <xsd:attribute name="Rel" type="xsd:string"/>
is illegal. Therefore I can not use the XSD file in VS I want to.
The hierachy of the XSD/the table is fixed, I can not enter that. Is there a way to keep the element "Detail" as a sub-element of "C" after the attributs?
Since I was provided with this file definition, I did not develope the XSD myself and need to adapt it, if necessary.
Attribute declarations have to come after complexType, otherwise you'll get an error such as the following:
Resolution: Move the attribute declarations below the
xsd:complexType
element (and remove the extraxsd:complexType
).There's another problem to fix too:
Resolution: Change the element declaration to use an existing or built-in type, or add the referenced type.
Corrected XSD: