[pro] how to validate an XML file agains an DTD?

Alexandre Rademaker arademaker at gmail.com
Wed Apr 4 15:43:13 UTC 2012


Hello,

I know that probably this is not the best place to ask this question
but my message to cxml-devel had no answer!! ;-(

http://lists.common-lisp.net/pipermail/cxml-devel/2012-March/000554.html

I need to validate a XML file that doesn't have the doctype
declaration. Actually, I don't have control over the creation of the XML files
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 against
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 returns 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

That is, it is working. I also tried with an invalid XML and the code fired
an error as expected! What about these warnings? Does anything changed
in the library and was not documented? How to solve them?

Best,

Alexandre Rademaker
http://arademaker.github.com/




More information about the pro mailing list