I have a local DTD file test.dtd. Content is :
<!DOCTYPE coord [
<!ELEMENT coord (date)>
<!ELEMENT date (#PCDATA)>
]>
I'd like to validate an XML using xmllint. This XML has no DOCTYPE in it :
<?xml version="1.0" encoding="x-mac-roman"?>
<coord>
<date>20150312</date>
</coord>
No problem if I insert the DTD block as a 2nd line into a copy of my XML file and use:
xmllint --valid --noout my2.xml
But when I try :
xmllint --loaddtd test.dtd --valid --noout my.xml
xmllint --dtdvalid test.dtd --noout my.xml
both don't work. The outout is :
test.dtd:1: parser error : Content error in the external subset
<!DOCTYPE coord [
^
test.dtd:1: parser error : Content error in the external subset
<!DOCTYPE coord [
^
Could not parse DTD test.dtd
Any idea ? It seems that my XML MUST contain a DOCTYPE line (with SYSTEM keyword) to reference the external DOCTYPE file, that I want to avoid. See : http://www.w3schools.com/dtd/
Is there any solution without modifying the XML ?