因为我的XSD不适用于Visual Studio 2010,所以我使用它来生成一个。我和生成的不同之处在于层次结构?我使用dtype来调用complexetypes。为什么这不起作用?XML Schema xsd禁止类型
的Visual Studio版本:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="top.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="top">
<xs:complexType>
<xs:sequence>
<xs:element name="child1">
<xs:complexType>
<xs:attribute name="attribute1" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="child2">
<xs:complexType>
<xs:attribute name="attribute2" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
我本人来说找到我的版本整齐,但有一个错误类型不能在这一点上可以作为参考来了:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="top.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="top">
<xs:complexType>
<xs:sequence>
<xs:element name="chield1" type="chield1" />
<xs:element name="chield2" type="chield2" />
</xs:sequence>
</xs:element>
<xs:complexType name="chield1">
<xs:attribute name="attribute1" type="xs:string" />
</xs:complexType>
<xs:complexType name="chield2">
<xs:attribute name="attribute2" type="xs:string" />
</xs:complexType>
</xs:schema>