C# 如何使用<;包括>;元素以重用在另一个架构中定义的架构?
我有一个包含UserDetails(UserDetails.xsd)的xsd 我有另一个Xsd,其中包含UserDetails列表(UserDetailsList.Xsd) 如何使用元素(或类似的东西)重用UserDetails.xsd中定义的模式 我尝试了以下方法,但无法编译:C# 如何使用<;包括>;元素以重用在另一个架构中定义的架构?,c#,asp.net,xml,xsd,include,C#,Asp.net,Xml,Xsd,Include,我有一个包含UserDetails(UserDetails.xsd)的xsd 我有另一个Xsd,其中包含UserDetails列表(UserDetailsList.Xsd) 如何使用元素(或类似的东西)重用UserDetails.xsd中定义的模式 我尝试了以下方法,但无法编译: <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchem
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="userDetailsList">
<xs:complexType>
<xs:sequence>
<xs:include schemaLocation="UserDetails.xsd"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
更新:
对不起,我自己找到的-将关闭它
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="UserDetails.xsd"/>
<xs:element name="userDetailsList">
<xs:complexType>
<xs:sequence>
<xs:element name="userDetails" minOccurs="1" maxOccurs="unbounded" type="userDetailsType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
由OP自己解决:
将其标记为社区维基以避免因投票而名誉扫地(以防万一)
您应该回答自己的问题,如果找到了解决方案,就接受它。将您的问题的解决方案编辑到您的问题中不会让我们其他人知道您已经解决了您的问题:)
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="UserDetails.xsd"/>
<xs:element name="userDetailsList">
<xs:complexType>
<xs:sequence>
<xs:element name="userDetails" minOccurs="1" maxOccurs="unbounded" type="userDetailsType" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>