Hello,
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?
Best,
Alexandre Rademaker http://arademaker.github.com/
Hello All,
Four months ago I posted the following message. Does anyone have any idea if the warnings was my mistake or a possible bug in the code of CXML? In the second case, with some directions I would be glad to help to fix the problem.
Best, Alexandre
On Wed, Mar 14, 2012 at 10:06 PM, Alexandre Rademaker arademaker@gmail.com wrote:
Hello,
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?
Best,
Alexandre Rademaker http://arademaker.github.com/
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.
Hello David,
Thank you for your message. Indeed, your tip worked and correctly omitted the warnings. As I said before, with some help and good description about the possible root cause of the bug, I would be glad to help you fix the bug in CXML code.
Best,
Alexandre Rademaker http://arademaker.github.com/
On Wed, Jul 11, 2012 at 11:33 AM, David Lichteblau david@lichteblau.com wrote:
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.