为什么我写的xml schema 不起作用???

xml文档如下:

 1<library nonamespaceschemalocation="D:\XML_TEXT\XML\library.xsd">
 2<book>
 3<name>计算机入门</name>
 4<author>张三</author>
 5<price>12.5</price>
 6<publish>海南</publish>
 7</book>
 8<book>
 9<name>word</name>
10<author>李四</author>
11<price>12.5</price>
12<publish>上海</publish>
13</book>
14<book>
15<name>vb</name>
16<author>刘二</author>
17<price>12.5</price>
18<publish>广州</publish>
19</book>
20</library>

xml schema:

 1<xs:schema xmlns:xs="http://www.book.com">
 2<xs:element name="book">
 3<xs:complextype>
 4<xs:sequence>
 5<xs:element name="name" type="lang:string"></xs:element>
 6<xs:element name="author" type="lang:string"></xs:element>
 7<xs:element name="price" type="lang:string"></xs:element>
 8<xs:element name="publish" type="lang:string"></xs:element>
 9</xs:sequence>
10</xs:complextype>
11</xs:element>
12<xs:element>
13<xs:complextype>
14<xs:sequence maxoccurs="" minoccurs="">
15<xs:element name="library" type="book"></xs:element>
16</xs:sequence>
17</xs:complextype>
18</xs:element>
19</xs:schema>

为什么总是提示我:No Schema\DTD declaration found.
---------------------------------------------------------------

 1<library nonamespaceschemalocation="D:\XML_TEXT\XML\library.xsd">   
 2  
 3位置错误,使用相对地址就好   
 4\---------------------------------------------------------------   
 5  
 6<xs:schema xmlns:xs="http://www.book.com"> 错了吧!   
 7schema的name space是固定的(http://www.w3.org/2001/XMLSchema),   
 8不能任意指定!   
 9  
10\---------------------------------------------------------------   
11  
12<schema xmlns="urn:schemas-microsoft-com:xml-data" xmlns:dt="urn:schemas-microsoft-com:datatypes"></schema></xs:schema></library>
Published At
Categories with Web编程
comments powered by Disqus