0

Using Python and lxml to validate a third-party XSD, I get the following error already while parsing the FB2 (FictionBook) schema:

lxml.etree.XMLSchemaParseError: attribute use (unknown), 
attribute 'ref': The QName value 
'{http://www.w3.org/XML/1998/namespace}lang' 
does not resolve to a(n) attribute declaration., line 52

The schema part responsible to this error looks like the following:

<xs:attribute ref="xml:lang"/>

In fact, FB2 is a well known format, so I can't imagine the schema really has an error; rather my parser has a wrong setting?

Here is my code following a working example from the lxml manual.

f = StringIO(file_to_string("data/spec/FictionBook.xsd"))
xmlschema_doc = etree.parse(f)
xmlschema = etree.XMLSchema(xmlschema_doc)

Open Food Broker
  • 1,095
  • 1
  • 8
  • 31

0 Answers0