XSD中的导入及其实现
我有两个单独的XSD,具有一些公共属性。我想创建另一个XSD,将所有公共属性放在单独的XSD中,并将它们导入到我已经拥有的两个XSD中,而不是在两个XSD中重复或复制它们 这种实施有什么参考吗?我们是这样做的: 共享“库”xsd:XSD中的导入及其实现,xsd,xsd.exe,xsd2code,linq-to-xsd,Xsd,Xsd.exe,Xsd2code,Linq To Xsd,我有两个单独的XSD,具有一些公共属性。我想创建另一个XSD,将所有公共属性放在单独的XSD中,并将它们导入到我已经拥有的两个XSD中,而不是在两个XSD中重复或复制它们 这种实施有什么参考吗?我们是这样做的: 共享“库”xsd: 左xsd具有相同的目标命名空间: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns="http://www.common.namespace/" xmlns:xs="http://ww
左xsd具有相同的目标命名空间:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.common.namespace/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.common.namespace/">
<xs:include schemaLocation="Common.xsd"/>
<xs:element name="MyLeftElement">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute ref="ACommonAttribute"/>
</xs:complexType>
</xs:element>
</xs:schema>
描述根元素的注释
具有不同目标命名空间的右xsd(如果是Include语句,则需要导入)
您所说的“此类实施的参考”是什么意思?这可以使用xsd:import和xsd:include完成。这里有一个以前问过的问题,可能会有所帮助。帮助。。谢谢..可能的副本
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.common.namespace/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.common.namespace/">
<xs:include schemaLocation="Common.xsd"/>
<xs:element name="MyLeftElement">
<xs:annotation>
<xs:documentation>Comment describing your root element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute ref="ACommonAttribute"/>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://another.namespace/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:libs="http://www.common.namespace/" targetNamespace="http://another.namespace/">
<xs:import namespace="http://www.common.namespace/" schemaLocation="Common.xsd"/>
<xs:complexType name="RightComplexType">
<xs:sequence>
<xs:element name="Bit">
<xs:complexType>
<xs:attribute ref="libs:ACommonAttribute"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:schema>