请教:关于XML schema的多个name space共同验证实例文档的问题!!

atmosphere 2003-12-14 08:50:08
这样一个XML schema:
<xs:schema targetNamespace="http://www.sdb.ac.cn/01" xmlns:sdb2="http://www.sdb.ac.cn/02"
~~~~~~~~~~~~~~~~~~~
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">
<xs:element name="schema1">
<xs:complexType>
<xs:all>
<xs:element name="a" type="xs:string"/>
<xs:element name="b" type="xs:string"/>
<xs:element name="c" type="sdb2:schema2"/>
~~~~~~~
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>

----------------------------
其中xmlns:sdb2="http://www.sdb.ac.cn/02" 是自己定义的另一个schema,而“sdb2:schema2”是其中的一个complextype的名称。

上面的文档应该没有xml语法错误吧?
以上文档在xml spy中提示是“无效”的,是否是因为该软件无法自动检索其他相关的自定义的schema?

很是困惑,谢谢指教!


...全文
46 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
atmosphere 2003-12-15
  • 打赏
  • 举报
回复
谢了!
受到你的提示,<xs:include schemaLocation="YourSchema.xsd"/>在此处应为
<xs:import schemaLocation="YourSchema.xsd"/>。
现在调试通过了,感激ing!
saucer 2003-12-14
  • 打赏
  • 举报
回复
you also need to provide the location for your schema (change "YourSchema.xsd" to the path to your schema file), for example

<xs:schema targetNamespace="http://www.sdb.ac.cn/01" xmlns:sdb2="http://www.sdb.ac.cn/02"

xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified"

attributeFormDefault="unqualified">

<xs:include schemaLocation="YourSchema.xsd"/>

see
http://www.w3.org/TR/xmlschema-0/#schemaLocation

http://www.zvon.org/xxl/XMLSchemaTutorial/Output/ser_include_st0.html

8,909

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧