【发布时间】:2015-03-11 12:34:17
【问题描述】:
以下是我的部分 XML 架构
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/Procurement"
xmlns:tns="http://www.example.org/Procurement" elementFormDefault="qualified">
<element name="CountryCode">
<simpleType>
<restriction base="string">
<enumeration value="US" />
<enumeration value="DE" />
<enumeration value="JP" />
</restriction>
</simpleType>
</element>
<element name="Address">
<complexType>
<sequence>
<element name="Name" type="string" minOccurs="0" />
<element name="StreeName" type="string" minOccurs="0" />
<element name="City" type="string" />
<element name="PostalCode" type="string" />
<element name="Country" type="CountryCode" />
</sequence>
</complexType>
</element>
</schema>
当我尝试验证此架构时,我收到与 Country 类型中的 CountryCode 属性相关的错误,例如
错误解析组件。检测到“CountryCode”位于命名空间“http://www.w3.org/2001/XMLSchema”中,但该命名空间中的组件无法从架构文档“file:///C:/Eclipse/workspace/Procurement.xsd”中引用。
我做了一些研究,也看到过类似的帖子,但仍然无法解决这个问题。
有什么想法吗?
【问题讨论】:
标签: xml xsd namespaces