当我在 mec.xsd 中定义 XML 模式时,它不适用于该元素。我该如何解决这个问题?谢谢。
<l:primary>XML</l:primary>
mec.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<people xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.com mc.xsd"
xmlns:l="http://www.example2.com"
xmlns="http://www.example.com">
<person>
<name>Marcus</name>
<language>
<l:primary>XML</l:primary>
</language>
</person>
</people>
mc.xsd
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com"
xmlns="http://www.example.com"
elementFormDefault="qualified">
<xs:element name="people">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="person">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="language">
<xs:complexType mixed="true">
<xs:element name="primary" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
主要.xsd(导入的架构)
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="http://www.example2.com">
<xs:element name="primary" type="xs:string"/>
</xs:schema>
mc.xsd(主要架构)
<xs:schema version="1.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.com"
xmlns="http://www.example2.com"
elementFormDefault="qualified">
<xs:import namespace="http://www.example2.com" schemaLocation="primary.xsd"/>
<xs:element name="people">
<xs:complexType mixed="true">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="person">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="language">
<xs:complexType mixed="true">
<xs:sequence>
<xs:element ref="primary"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)