[XML-SIG] docbook 5, lxml and rng
stefan_ml at behnel.de
Sun May 31 08:04:47 CEST 2009
Tim Arnold wrote:
> Hi, this is a newbie question I'm sure. I'm trying to validate an
> example straight out of the docbook 5 documentation (example given
> on the 'inlineequation' page). As it stands, the file doesn't pass
> as valid.
> The code:
> from lxml import etree
> import os
> # RNGDIR = 'path to docbook.rng'
> # XMLDIR = 'path to the xml file'
> relaxng_doc = etree.parse(os.path.join(RNGDIR,'docbook.rng'))
> relaxng = etree.RelaxNG(relaxng_doc)
> doc = etree.parse(os.path.join(XMLDIR,'myfile.xml'))
> print relaxng.validate(doc)
What does the validator tell you why it's not considered valid? Note that
there's a property "error_log" which returns a sequence of messages that
were collected during validation.
More information about the XML-SIG