I'm trying to use xmllint
to validate very large (3-4 gig) XML files against an external DTD using the --dtdvalid
switch. It appears that when also using --stream
, no DTD validation occurs.
I've tested using much smaller XML files, and when not using the --stream
switch with this command: xmllint --noout --nonet --timing --dtdvalid Test.dtd Test.xml
I get expected output:
Parsing took 42 ms
Parsing DTD took 0 ms
<Lots of errors here because the XML is purposely wrong to get errors>
Document Test.xml does not validate against Test.dtd
Validating against DTD took 1148 ms
Freeing took 7 ms
But if I add the --stream
option, it appears to ignore DTD validation.
xmllint --stream --noout --nonet --timing --dtdvalid Test.dtd Test.xml
Output shows only XML well-formed validation, no signs that it tried to validate against the DTD:
Parsing took 41 ms
Does DTD validation not work with --stream
on purpose, or am I missing something obvious to everyone but me? Using xmllint version 20913 if it matters.
According to the man page:
--stream Use streaming API - useful when used in combination with --relaxng or --valid options for validation of files that are too large to be held in memory.
So the command line should be:
xmllint --stream --noout --nonet --timing --valid --dtdvalid tutorials.dtd tutorials.xml
Parsing and validating took 0 ms