微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

春季-具有多个名称空间的xml的扩展xsd

嘿,我试图为不同的名称空间打开XML模式,这似乎可行,但是所有名称空间元素现在都无效.

先感谢您.我正在尝试实现与Spring相同的架构扩展机制(即:spring-beans.2.5.xsd),它们也为## other打开了bean定义,这可行!

添加一个example of these three files,可以轻松访问zip存档,并将其上传到一键式托管Rapidshare.

我怎么了

example-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>

custom-example-list.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>

example-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> 

错误

发现无效的内容以元素“ bar”开头.预期为“ {foo,bar,baz,WC [## other:“ http://www.example.org/schema/list”]}“之一

最佳答案
哇,真是辛苦.自从我不得不继续对xsd进行随机更改并验证看看会发生什么以来已经很长时间了.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐