6

I'm trying to use lxml with the xs:assert validation tag. I've tried using the example from this IBM page: http://www.ibm.com/developerworks/library/x-xml11pt2/

<xs:element name="dimension">
  <xs:complexType>
    <xs:attribute name="height" type="xs:int"/>
    <xs:attribute name="width" type="xs:int"/>
    <xs:assert test="@height < @width"/>
  </xs:complexType>
</xs:element>

It seems like lxml doesn't support XML Schema 1.1.

Can someone validate this? What XML (for Python) engine does support Schema 1.1?

Nitay
  • 4,193
  • 6
  • 33
  • 42

2 Answers2

1

Yea, libxml does not support xsd 1.1. Use xmlschema >=1.0.14 instead.

Alex
  • 1,602
  • 20
  • 33
0

The two schema processors that currently support XSD 1.1 are Xerces and Saxon - both Java based.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164
  • Thanks for your answer. What about the Microsoft technologies? – Nitay Sep 27 '11 at 07:15
  • Nevermind - The Wikipedia article is pretty informative about this. Thanks. http://en.wikipedia.org/wiki/XML_Schema_(W3C)#Version_1.1 – Nitay Sep 27 '11 at 07:19
  • This answer did not age well. Meanwhile there is as well the python package `xmlschema`. See [my answer](https://stackoverflow.com/a/73685488/1599887). – Alex Sep 12 '22 at 06:59
  • Thanks for the update. I did write "currently", so I think it aged perfectly well! But I'm very pleased to see that there's a new XSD 1.1 processor now available. The answer also failed to mention the Altova schema processor. – Michael Kay Sep 14 '22 at 21:20