关于XML和Schema的有关问题
关于XML和Schema的问题
现在有一个schema文件(node.xsd)如下:
有一个XML文件(node.xml)如下:
我使用的是xmlSpy对node.xml文件进行验证,但是验证不通过。
报的错误是无法从node.xsd文件中加载(load)名称空间http://www.w3school.com.cn
Unable to load a schema with target namespace 'http://www.w3school.com.cn' from 'note.xsd'.
请问大家这个问题怎么解决.我用的xmlSpy的激活码过期了,它叫我去官网注册,我没理这个提示,不会是由于这个原因吧(我想是不会的)。。。
提前感谢大家了.
------解决方案--------------------
<note
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn note.xsd">
应该是node.xsd
现在有一个schema文件(node.xsd)如下:
- XML code
<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3school.com.cn" xmlns="http://www.w3school.com.cn" elementFormDefault="qualified"> <xs:element name="note"> <xs:complexType> <xs:sequence> <xs:element name="to" type="xs:string"/> <xs:element name="from" type="xs:string"/> <xs:element name="heading" type="xs:string"/> <xs:element name="body" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
有一个XML文件(node.xml)如下:
- XML code
<?xml version="1.0"?> <note xmlns="http://www.w3school.com.cn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3school.com.cn note.xsd"> <to>George</to> <from>John</from> <heading>Reminder</heading> <body>Don't forget the meeting!</body> </note>
我使用的是xmlSpy对node.xml文件进行验证,但是验证不通过。
报的错误是无法从node.xsd文件中加载(load)名称空间http://www.w3school.com.cn
Unable to load a schema with target namespace 'http://www.w3school.com.cn' from 'note.xsd'.
请问大家这个问题怎么解决.我用的xmlSpy的激活码过期了,它叫我去官网注册,我没理这个提示,不会是由于这个原因吧(我想是不会的)。。。
提前感谢大家了.
------解决方案--------------------
<note
xmlns="http://www.w3school.com.cn"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3school.com.cn note.xsd">
应该是node.xsd