将多个模式集读入数据集中
我正在尝试从 XmlSchema 生成数据集,我有另一个定义简单类型 i 的架构。如何将多个模式添加到数据集中
第一个模式将生成数据集的结构,模式中的元素之一是
<xs:element name="CkptID" type="EM_SignedInt" />
类型“EM_SignedInt”在不同的模式中提到
第二个定义简单类型的模式如下
<xs:complexType name = "EM_SignedInt">
<xs:simpleContent>
<xs:extension base="xs:int">
<xs:attributeGroup ref="AttG_Property"/>
</xs:extension>
</xs:simpleContent>
如何做我将类型添加到数据集中?
I'm trying to generate a DataSet from a XmlSchema I have a another schema defining a simple type i. How can I add multiple schemas into a Dataset
The First Schema would generate the structure of the Dataset and one of the elements in the schema is
<xs:element name="CkptID" type="EM_SignedInt" />
The type " EM_SignedInt " is mentioned in a different schema
The second Schema defining the simple type is below
<xs:complexType name = "EM_SignedInt">
<xs:simpleContent>
<xs:extension base="xs:int">
<xs:attributeGroup ref="AttG_Property"/>
</xs:extension>
</xs:simpleContent>
How do I add the type to the Dataset?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决了。要解决此问题,请使用 xs:include 在主架构中包含定义简单类型的架构。这里需要注意的重要一点是,我们不应在架构中包含“targetNamespace”参数,该参数必须包含在任何其他架构中,以便它自动包含主架构中定义的名称空间并成为该架构的一部分。
在主模式(本例中为 Main.xsd)中包含以下参数:
要包含定义简单类型的模式(本例中为 base.xsd),请使用:
现在您可以添加此主模式以加载到数据集中工作正常!
Solved. To resolve this issue, include the schema which defines the simple type in the main schema using xs:include. The important point to note here is that we should not include the "targetNamespace" parameter in the schema which has to be included in any other schema so that it automatically includes the namespace which is defined in the main schema and becomes a part of that schema.
Include the following parameters in the main schema(Main.xsd, in this case):
To include the schema defining the simple type(base.xsd in this case),use:
Now you can add this main schema to load into the dataset which works fine!