Discussion:
how to validate an XML file agains an DTD?
Alexandre Rademaker
2012-04-04 15:43:13 UTC
Permalink
Content preview: 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
[...]

Content analysis details: (-0.7 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low
trust
[209.85.214.51 listed in list.dnswl.org]
0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
(arademaker[at]gmail.com)
-0.0 SPF_PASS SPF: sender matches SPF record
0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid
Archived-At: <http://permalink.gmane.org/gmane.lisp.cl-pro/619>

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
(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/

Loading...