2013-02-12 2 views
0

내 DTD의 유효성을 검사하기 위해 http://www.xmlvalidation.com/index.php을 사용하고 있지만 XML 닫기 태그에서 오류가 발생하고 있습니다.태그를 닫을 때 XML DTD 오류 - 유효성 검사 오류

XML :

1 <?xml version="1.0" encoding="utf-8" ?> 
2 <!DOCTYPE books SYSTEM "books.dtd"> 
3 <books> 
4  <book title="Le Mans 24 Hours: The Official History of the World's Greatest Motor Race 1960-69" imageurl="images/1960-89.jpg"> 
5  <description> 
6   <author>Quentin Spurring.</author> 
7   <publisher>J H Haynes and Co Ltd.</publisher> 
8   <publishDate>15 August 2010</publishDate> 
9   <ISBN10>1844255840</ISBN10> 
10  <ISBN13>9781844255849</ISBN13> 
11  <blurb>Covers different races since 1923. This title also includes photographs, a race account, results data and a glorious rendering of the official race poster.</blurb> 
12  </description> 
13 </book> 
14 <book title="Le Mans 24 Hours: The Official History of the World's Greatest Motor Race 1970-79" imageurl="images/1970-79.jpg"> 
15  <description> 
16  <author>Quentin Spurring.</author> 
17  <publisher>J H Haynes and Co Ltd.</publisher> 
18  <publishDate>15 March 2011</publishDate> 
19  <ISBN10>1844255395</ISBN10> 
20  <ISBN13>9781844255399</ISBN13> 
21  <blurb>Officially licensed with the ACO, the organisers of the annual Le Mans 24 Hours sports car race, this book covers various races since 1923.</blurb> 
22  </description> 
23 </book> 
24 </books> 

DTD : 오류의

<?xml version="1.0" encoding="UTF-8"?> 
<!ELEMENT books (book+)> 
<!ELEMENT book (title, imageurl, description, author, publisher, publishDate, ISBN10, ISBN13, blurb)> 
<!ELEMENT description (#PCDATA)> 
<!ELEMENT author (#PCDATA)> 
<!ELEMENT publisher (#PCDATA)> 
<!ELEMENT publishDate (#PCDATA)> 
<!ELEMENT ISBN10 (#PCDATA)> 
<!ELEMENT ISBN13 (#PCDATA)> 
<!ELEMENT blurb (#PCDATA)> 

목록 :

4: 129 Attribute "imageurl" must be declared for element type "book". 
    4: 129 Attribute "title" must be declared for element type "book". 
    12: 19 The content of element type "description" must match "null". 
    13: 10 The content of element type "book" must match "(title,imageurl,description,author,publisher,publishDate,ISBN10,ISBN13,blurb)". 
    14: 129 Attribute "imageurl" must be declared for element type "book". 
    14: 129 Attribute "title" must be declared for element type "book". 
    22: 19 The content of element type "description" must match "null". 
    23: 10 The content of element type "book" must match "(title,imageurl,description,author,publisher,publishDate,ISBN10,ISBN13,blurb)". 

가 어떻게 DTD의에서 닫는 태그를 처리합니까?

답변

2

태그를 닫는 것과 아무런 관련이 없습니다. book에 대한 속성을 선언해야하고 bookdescription 요소에 대한 모델을 수정해야했습니다.

새로운 DTD

<!ELEMENT books (book+)> 
<!ELEMENT book (description)> 
<!ATTLIST book 
      title CDATA #REQUIRED 
      imageurl CDATA #REQUIRED> 
<!ELEMENT description (author, publisher, publishDate, ISBN10, ISBN13, blurb)> 
<!ELEMENT author (#PCDATA)> 
<!ELEMENT publisher (#PCDATA)> 
<!ELEMENT publishDate (#PCDATA)> 
<!ELEMENT ISBN10 (#PCDATA)> 
<!ELEMENT ISBN13 (#PCDATA)> 
<!ELEMENT blurb (#PCDATA)> 

참고 : 나는 필요한 titleimageurl 특성을했다. 데이터에 따라 암시 적으로 표시 할 수 있습니다.