[lxml-dev] etree.XMLSchema generic error "Document is not valid XML Schema"

Stefan Behnel stefan_ml at behnel.de
Mon May 7 05:45:36 CEST 2007


Hi,

Holger Joukl wrote:
> is there any chance to expose more detailed information on why a schema
> document is not a valid XML Schema?
> A brief look at libxml2 schema API did not really tell me anything.

Have you looked at the error log of the exception?

  >>> from lxml.etree import XML, XMLSchema
  >>> try:
  ...   XMLSchema(XML("<honk xmlns='http://www.w3.org/2001/XMLSchema'/>"))
  ... except Exception, e:
  ...   print e.error_log
  <string>:0:ERROR:SCHEMASP:SCHEMAP_NOT_SCHEMA: The XML document '(null)' is
not a schema document.


I assume the reported errors here are more telling if you pass a real schema
document, though.

Stefan



More information about the lxml-dev mailing list