Xml 在XSD中共享定义的技术?
我们正在构建企业范围的XML模式。由不同团队构建的模式之间存在公共元素,我们希望所有这些模式对相同的数据元素具有相同的名称,因此是否有方法让它们使用相同的数据字典 在构建模式时,我们会向数据字典中添加元素,但希望所有元素都使用相同的名称Xml 在XSD中共享定义的技术?,xml,dictionary,xsd,xml-validation,Xml,Dictionary,Xsd,Xml Validation,我们正在构建企业范围的XML模式。由不同团队构建的模式之间存在公共元素,我们希望所有这些模式对相同的数据元素具有相同的名称,因此是否有方法让它们使用相同的数据字典 在构建模式时,我们会向数据字典中添加元素,但希望所有元素都使用相同的名称 例如,在所有不同的模式中,customerfirstname应该是相同的,我们如何实现这一点 您可以通过名称空间实现XSD中词汇表的共享和非共享控制之间的分离 组1(和其他组)可以在他们控制的命名空间中定义XSD, <xs:schema xmlns:xs=
例如,在所有不同的模式中,
customerfirstname
应该是相同的,我们如何实现这一点 您可以通过名称空间实现XSD中词汇表的共享和非共享控制之间的分离
组1(和其他组)可以在他们控制的命名空间中定义XSD,
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:g1="http://example.com/group1"
xmlns:c1="http://example.com/common"
targetNamespace="http://example.com/group1">
<xs:import namespace="http://example.com/common" schemaLocation="common.xsd"/>
<xs:element name="Group1X">
<xs:complexType>
<xs:sequence>
<xs:element ref="g1:Group1Y"/>
<xs:element ref="c1:Common1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Group1Y" type="xs:string"/>
</xs:schema>
并在公共共享控制下的命名空间中导入XSD:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/common">
<xs:element name="Common1" type="xs:string"/>
</xs:schema>
以便两者可以在同一个XML文档中使用
<?xml version="1.0" encoding="UTF-8"?>
<g1:Group1X xmlns:g1="http://example.com/group1"
xmlns:c1="http://example.com/common"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.com/group1 group1.xsd">
<g1:Group1Y>
Vocabulary in the "http://example.com/group1" namespace is under
the control of group 1.
</g1:Group1Y>
<c1:Common1>
Vocabulary in the "http://example.com/common" namespace is under
common control.
</c1:Common1>
</g1:Group1X>
英语词汇http://example.com/group1“名称空间正在使用中
对照组1。
英语词汇http://example.com/common“名称空间正在使用中
共同控制。
没有冲突,按要求。您可以通过名称空间实现XSD中词汇表的共享和非共享控制之间的分离 组1(和其他组)可以在他们控制的命名空间中定义XSD,
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:g1="http://example.com/group1"
xmlns:c1="http://example.com/common"
targetNamespace="http://example.com/group1">
<xs:import namespace="http://example.com/common" schemaLocation="common.xsd"/>
<xs:element name="Group1X">
<xs:complexType>
<xs:sequence>
<xs:element ref="g1:Group1Y"/>
<xs:element ref="c1:Common1"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Group1Y" type="xs:string"/>
</xs:schema>
并在公共共享控制下的命名空间中导入XSD:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.com/common">
<xs:element name="Common1" type="xs:string"/>
</xs:schema>
以便两者可以在同一个XML文档中使用
<?xml version="1.0" encoding="UTF-8"?>
<g1:Group1X xmlns:g1="http://example.com/group1"
xmlns:c1="http://example.com/common"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.com/group1 group1.xsd">
<g1:Group1Y>
Vocabulary in the "http://example.com/group1" namespace is under
the control of group 1.
</g1:Group1Y>
<c1:Common1>
Vocabulary in the "http://example.com/common" namespace is under
common control.
</c1:Common1>
</g1:Group1X>
英语词汇http://example.com/group1“名称空间正在使用中
对照组1。
英语词汇http://example.com/common“名称空间正在使用中
共同控制。
没有冲突,如请求。由于架构可以包含另一个架构文件,因此您可以拥有每个团队架构包含的公共xsd。由于架构可以包含另一个架构文件,因此您可以拥有每个团队架构包含的公共xsd。