如何解决尝试包含在另一个架构中定义的元素
我想创建一个引用另一个架构中的元素的XML架构,但是Visual Studio表示“命名空间'[otherschema]无法在该架构中引用”
这是我的外部模式,它定义了一个“模块”文档:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
xmlns="http://www.real-sense.com/ice/IceModule.xsd"
xmlns:inst="http://www.real-sense.com/ice/IceInstructions.xsd"
xsi:schemaLocation="http://www.real-sense.com/ice/IceInstructions.xsd IceInstructions.xsd"
targetNamespace="http://www.real-sense.com/ice/IceModule.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
attributeFormDefault="unqualified"
elementFormDefault="qualified">
<xs:element name="module">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string">
<xs:annotation>
<xs:documentation>Unique Name of Module</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="description" type="xs:string">
<xs:annotation>
<xs:documentation>Description of Module</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="instructions" type="inst:Instructions">
<xs:annotation>
<xs:documentation>Instruction to carry out when executing this module</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
该模式试图定义一个在“ instructions”模式中定义的“ instructions”元素,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema
attributeFormDefault="unqualified"
elementFormDefault="unqualified"
xmlns="http://www.real-sense.com/ice/IceInstructions.xsd"
targetNamespace="http://www.real-sense.com/ice/IceInstructions.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="Instructions">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="Instruction" type="xs:string">
</xs:element>
</xs:sequence>
<xs:attribute name="var" type="xs:string" use="optional" />
<xs:attribute name="name" type="xs:string" use="optional" />
</xs:complexType>
</xs:schema>
Visual Studio在错误的模块架构中的“指令”元素,但我有:
不确定我在做什么错。有什么想法吗?
这将是最终的xml文件(尽管我还没有达到这个阶段)
<module>
<name>Fred</name>
<description>My description</description>
<instructions>
<instruction>
</instruction>
<instruction>
</instruction>
<instruction>
</instruction>
</instructions>
</module>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。