嘿,我正试图为不同的名称空间打开我的XML模式,这似乎有效,但所有默认的名称空间元素现在都无效。
提前谢谢。我试图实现与Spring中相同的模式扩展机制(即SpringBeans.2.5.xsd),它们打开
bean
定义也适用于
##other
这是有效的!
我添加了一个
example of these three files
为了方便访问压缩文件并上传到点击一次的hoster rapidshare。
什么是我的错?
示例-list.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.example.org/schema/list"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/schema/list">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" />
<xs:complexType name="ExampleListModelType">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="ExampleListGroup" />
</xs:choice>
</xs:complexType>
<xs:group name="ExampleListGroup">
<xs:choice>
<xs:element name="foo" type="xs:string" />
<xs:element name="bar" type="xs:string" />
<xs:element name="baz" type="xs:string" />
<xs:any namespace="##other" processContents="strict" />
</xs:choice>
</xs:group>
<xs:element name="action-list" type="ExampleListModelType" />
</xs:schema>
自定义示例列表.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.example.org/schema/custom" elementFormDefault="qualified"
targetNamespace="http://www.example.org/schema/custom">
<xs:element name="eek" type="xs:string" />
</xs:schema>
示例-list.xml
<?xml version="1.0" encoding="UTF-8"?>
<action-list xmlns="http://www.example.org/schema/list"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:custom="http://www.example.org/schema/custom"
xsi:schemaLocation="
http://www.example.org/schema/list example-list.xsd
http://www.example.org/schema/custom custom-example-list.xsd">
<custom:eek></custom:eek>
<bar></bar>
</action-list>
误差
Invalid content was found starting with element 'bar'. One of '{foo, bar, baz, WC[##other:"http://www.example.org/schema/list"]}' is expected