Hi,
Quoting Alexandre Rademaker (arademaker@gmail.com):
I need to validate a XML file that doesn't have the doctype declaration. Actually, I don't control how the XML files are created so I am not able to change the fact that those files don't have doctype declarations. My problem is how to validate does files agains a DTD. I found at http://common-lisp.net/project/cxml/sax.html#parser that the correctly way should be:
(let ((d (cxml:parse-file "0675365413696898.xml" (cxml-dom:make-dom-builder)))
(x (cxml:parse-dtd-file "LMPLCurriculo.DTD"))) (dom:map-document (cxml:make-validator x #"CURRICULO-VITAE") d))
But that gives me two warnings and return a NIL
Warning: deprecated SAX default method used by a handler that is not a subclass of SAX:ABSTRACT-HANDLER or HAX:ABSTRACT-HANDLER Warning: deprecated SAX default method used by a handler that is not a subclass of SAX:ABSTRACT-HANDLER or HAX:ABSTRACT-HANDLER NIL
It seems to work. I also tried with an invalid XML and the code fired an error! Nevertheless, what are bothering me are does warnings!! Any idea?
sorry for the late response. The warnings are a cxml bug I haven't fixed yet (sorry about that, too :-)). Until then, my recommendation is to use the following workaround:
(handler-bind ((warning #'muffle-warning)) ...)
around the call to map-document to suppress the warnings and any related performance issues.
Best regards d.