关于xml schame出现的命名空间错误

rc-resolve.4.2: Error resolving component 'usertype'. It was detected that 'usertype' is in 
 namespace 'http://www.w3.org/2001/XMLSchema', but components from this namespace are not 

 referenceable from schema document 

以上错误来源一以下的关系型xml schame

<?xml version="1.0" encoding="UTF-8"?>
<!-- 本空间用的是xs -->
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/user3" 
xmlns:tns="http://www.example.org/user3" elementFormDefault="qualified">
      
<element name="users" type="tns:userstype"></element>
<element name="user" type="usertype"></element>

<element name="name"></element>
<element name="password"></element>
<element name="age"></element>

<complexType name="userstype">
  <sequence>
   <element  ref="user"></element>
  </sequence>
</complexType>


<complexType name="usertype">
  <sequence>
   <element  ref="name"></element>
   <element  ref="password"></element>
   <element  ref="age"></element>
  </sequence>
  <attribute  name="id" use="required" > </attribute>
  <attribute  name="note" use="optional"  > </attribute>
</complexType>


</schema>
为什么呢, 原来是原本的 element  来源于默认的命名空间 
http://www.w3.org/2001/XMLSchema

而对于usertype ,password,age, name 是自定义的命名空间

xmlns:tns="http://www.example.org/user3"
所以必须定义自己命名空间

在ref、、还有就是type中要改

tns:password 之类的



以下就是正确的

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值