2013-10-14 2 views
0

XML 파일과 XML 스키마를 검증 용으로 만들었습니다. 나는 그것을 시도했지만 약간의 오류를 준다.Validator가 약간의 오류를 표시합니다.

XML 파일의 형식이 잘되어 있으며 XML 스키마도 형식이 잘되어 있습니다. 그러나 XSD로 XML 유효성 검사를 시도하면 오류가 발생합니다. 그림 : LINK

I가 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> 
+1

xsd에 book 요소가 없습니다. –

+0

스키마에 구조가 정확하게 반영되어 있지 않습니다. 라이브러리에는 book ID 및 title과 같은 요소가 들어있는 book이라는 복잡한 유형의 시퀀스가 ​​들어 있습니다. 그건 당신의 스키마가 말하는 것이 아닙니다. –

답변

0

토니 홉킨슨이 대답을 주었지만 답변으로 표시하지 않았습니다. xsd에 book 요소가 없습니다.

+0

대답 할 가치가 거의 없습니다. 아마도 Doh라는 태그가 있어야합니다. :) –

관련 문제