[lxml-dev] Invalid Schematron
Hi all, i'm trying to validate an OVAL (http://oval.mitre.org) xml document against it's schematron rules ( http://oval.mitre.org/language/version5.7/ovaldefinition/schematron/oval-def... ) Following the manual (http://codespeak.net/lxml/validation.html) i wrote the following piece of code: from lxml import etree rule = open("oval-definitions-schematron.sch") defs = open("oval.xml") sct_doc = etree.parse(rule) try: schematron = etree.Schematron(sct_doc) except etree.SchematronParseError, e: print e.args print e.error_log print e.message doc = etree.parse(defs) print schematron.validate(doc) but i got the following error(s): Document is not a valid Schematron schema oval-definitions-schematron.sch:34:0:ERROR:SCHEMASP:SCHEMAP_NOROOT: Expecting a pattern element instead of phase (repeated N times) ... oval-definitions-schematron.sch:1547:0:ERROR:SCHEMASP:SCHEMAP_NOROOT: Failed to compile context expression oval-def:objects/*/*[@datatype='binary']|oval-def:states/*/*[@datatype='binary']|oval-def:states/*/* (repeated N times) $ dpkg -l | grep libxml2 ii libxml-libxml-perl 1.70.ds-1 Perl interface to the libxml2 library ii libxml2 2.7.6.dfsg-1ubuntu1 GNOME XML library ii libxml2-dev 2.7.6.dfsg-1ubuntu1 Development files for the GNOME XML library ii libxml2-utils 2.7.6.dfsg-1ubuntu1 XML utilities ii python-libxml2 2.7.6.dfsg-1ubuntu1 Python bindings for the GNOME XML library on Ubuntu 10.04 Can you help me? Thanks --- Masetto
masetto
Hi all,i'm trying to validate an OVAL (http://oval.mitre.org) xml document against it's schematron rules (http://oval.mitre.org/language/version5.7/ovaldefinition/schematron/oval- definitions-schematron.sch) Following the manual (http://codespeak.net/lxml/validation.html) i wrote the following piece of code:
from lxml import etree rule = open("oval-definitions-schematron.sch") defs = open("oval.xml") sct_doc = etree.parse(rule) try: schematron = etree.Schematron(sct_doc) except etree.SchematronParseError, e: print e.args print e.error_log print e.message
snip<
but i got the following error(s):Document is not a valid Schematron schema oval-definitions-schematron.sch:34:0:ERROR:SCHEMASP:SCHEMAP_NOROOT: Expecting a pattern element instead of phase (repeated N times) oval-definitions-schematron.sch:1547:0:ERROR:SCHEMASP:SCHEMAP_NOROOT: Failed to compile context expression oval-def:objects/*/*[ <at> datatype='binary']|oval-def:states/*/*[ <at> datatype='binary']|oval-def:states/*/* (repeated N times)
Can you help me?
Thanks---Masetto
I'm having the same problem. In my case I get the error
Failed to compile context expression
//*[gmd:identificationInfo/gmd:MD_DataIdentification]
in the schematron rule:
masetto, 16.07.2010 14:07:
i'm trying to validate an OVAL (http://oval.mitre.org) xml document against it's schematron rules Following the manual (http://codespeak.net/lxml/validation.html) i wrote the following piece of code:
from lxml import etree
rule = open("oval-definitions-schematron.sch") defs = open("oval.xml")
sct_doc = etree.parse(rule) try: schematron = etree.Schematron(sct_doc) except etree.SchematronParseError, e: print e.args print e.error_log print e.message
doc = etree.parse(defs) print schematron.validate(doc)
but i got the following error(s):
Document is not a valid Schematron schema oval-definitions-schematron.sch:34:0:ERROR:SCHEMASP:SCHEMAP_NOROOT: Expecting a pattern element instead of phase (repeated N times) ... oval-definitions-schematron.sch:1547:0:ERROR:SCHEMASP:SCHEMAP_NOROOT: Failed to compile context expression oval-def:objects/*/*[@datatype='binary']|oval-def:states/*/*[@datatype='binary']|oval-def:states/*/* (repeated N times)
Try to validate the document with libxml2's xmllint tool on the command line. If that fails, too, try lxml 2.3, which has true ISO Schematron support in the "lxml.isoschematron" package. Stefan
participants (3)
-
James Long
-
masetto
-
Stefan Behnel