[lxml-dev] XMLSchema validation with XMLSchema.xsd failing

David Pratt fairwinds at eastlink.ca
Sat Jun 2 18:08:14 CEST 2007


Can someone advise whether XMLSchema is currently able validate xml 
schemas. I am on mac 10.4.9 using lxml 1.3 beta using macs default 
libxml2. In my initial attempt, I am getting the following errors (after 
catching the exception in the log). I am using XMLSchema.xsd to validate 
against as you can see. The error comes before my next step - which 
would validate the schema I am interested in.

Here is my session:

 >>> import lxml.etree
 >>> from am.xmlschema import xmlschema_path
 >>> xmlschema_doc = lxml.etree.parse(xmlschema_path)
 >>> try:
...     xmlschema = lxml.etree.XMLSchema(xmlschema_doc)
... except Exception, e:
...     print e.error_log
...
/Users/davidpratt/Desktop/xmlschemademo/dev/am.xmlschema/src/am/xmlschema/XMLSchema.xsd:655:ERROR:SCHEMASP:SCHEMAP_REDEFINED_ELEMENT: 
Element 'element': A global element declaration with the name 'element' 
does already exist.
/Users/davidpratt/Desktop/xmlschemademo/dev/am.xmlschema/src/am/xmlschema/XMLSchema.xsd:864:ERROR:SCHEMASP:SCHEMAP_REDEFINED_ELEMENT: 
Element 'element': A global element declaration with the name 'group' 
does already exist.
 >>>

Many thanks

Regards
David


More information about the lxml-dev mailing list