Re: [xml] Validation with xmllint, parser errors



Umut Emin schrieb:
i have a plain horizontal external dtd file which i want xmllint to
validate it.

xmllint --valid --noout file.dtd
file.dtd:1: parser error : StartTag: invalid element name
<!ELEMENT document (postal_data,main_data)>
 ^
file.dtd:1: parser error : Extra content at the end of the document
<!ELEMENT document (postal_data,main_data)>
 ^

The error messages are pretty clear. Your DTD is not a well-formed XML
document - which is not surprising, if you think about it.

It looks like you misunderstood the xmllint command syntax. The option
--valid asks xmllint to validate the document against the DTD specified
in the DOCTYPE; xmllint still wants you to give it an XML document.

A DTD syntax check happens anyway.

Compare:

  xmllint --valid bla.xml
  xmllint --dtdvalid bla.dtd bla.xml

Michael Ludwig



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]