0
我做了一個XML文件和XML模式進行驗證。我試過了,但它給我一些錯誤。驗證器顯示我一些錯誤
XML文件格式正確,XML Schema也格式良好。但是當我嘗試使用XSD驗證XML時,它會給我一些錯誤。 圖片:LINK
當我在XSD改線2:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com">
它給了我另一個錯誤圖片:LINK
你能不能幫我在哪裏,我在做的錯誤嗎?
從2013年10月14日10:57更新(從答案複製):
對不起,我有點勞累過度,我不知道,我已經缺失書標籤。但是,它仍然給我一個錯誤。我仍然做錯了什麼?我附加了我的XML和XML模式。
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3schools.com">
<xs:element name="library">
<xs:complexType>
<xs:sequence>
<xs:element name="book"/>
<xs:element name="book_id" type="xs:integer"/>
<xs:element name="title" type="xs:string"/>
<xs:element name="author" type="xs:string"/>
<xs:element name="count" type="xs:integer"/>
<xs:element name="genre" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
<?xml version="1.0"?>
<library>
<book>
<book_id>5</book_id>
<title>Sokak</title>
<author>Tony</author>
<count>6</count>
<genre>epic</genre>
</book>
<book>
<book_id>13</book_id>
<title>Kucharka</title>
<author>Fiona</author>
<count>8</count>
<genre>Hobby</genre>
</book>
</library>
您在xsd中沒有書籍元素 –
我認爲您的架構不能準確反映結構。一個庫包含一個稱爲book的複雜類型序列,其中包含書籍ID和標題等元素。這不是你的模式所說的。 –