2017-09-15 67 views
0

我無法驗證我的XML文檔。我收到一條錯誤消息The Value Of Attribute "xmlns:xs" Associated With An Element Type "xs:schema" Must Not Contain The '<' Character.我在代碼中找不到任何語法錯誤。無法驗證XML文檔。 「xs:schema」必須不包含'<'字符

這是我的XML代碼:

<?xml version="1.0" encoding="utf-8"?> 
 
<bookstore> 
 
<book> 
 
    <title>The Hunger Games</title> 
 
    <author>Suzzanne Collins</author> 
 
    <price>299</price> 
 
</book> 
 
<book> 
 
    <title>Divergent</title> 
 
    <author>Veronica Roth</author> 
 
    <price>399</price> 
 
</book> 
 
<book> 
 
    <title>Me Before you</title> 
 
    <author>JoJoMoyes</author> 
 
    <price>299</price> 
 
</book> 
 
</bookstore>

,這是XSD文件:

<?xml version="1.0"?> 
 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema> 
 
<xs:element name="bookstore"> 
 
    <xs:complexType> 
 
    <xs:sequence> 
 
    <xs:element name="book" maxOccurs="unbounded"> 
 
    <xs:complexType> 
 
     <xs:sequence> 
 
     <xs:element name="title" type="xs:string"/> 
 
     <xs:element name="author" type="xs:string"/> 
 
     <xs:element name="price" type="xs:integer"/> 
 
     </xs:sequence> 
 
    </xs:complexType> 
 
    </xs:element> 
 
    </xs:sequence> 
 
</xs:complexType> 
 
    </xs:element> 
 
</xs:schema>

回答

2

您的架構的第二行是

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema> 

你缺少右引號,它應該是

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
相關問題