Python - working with xml/lxml/objectify/schemas, datatypes, and assignments

Dieter Maurer dieter at handshake.de
Wed Jan 11 13:21:06 EST 2023


aapost wrote at 2023-1-10 22:15 -0500:
>On 1/4/23 12:13, aapost wrote:
>> On 1/4/23 09:42, Dieter Maurer wrote:
>> ...
>>> You might have a look at `PyXB`, too.
>>> It tries hard to enforce schema restrictions in Python code.
>> ...
>Unfortunately picking it apart for a while and diving deeper in to a
>rabbit hole, PyXB looks to be a no-go.
>
>PyXB while interesting, and I respect it's complexity and depth, is
>lacking in design consistency in how it operates if you are trying to
>modify and work with the resulting structure intuitively.
> ... problem with simple types ...

I use `PyXB` in `dm.saml2` and `dm.zope.saml2`, i.e. with
the SAML2 schema definitions (which include those
of XML signature and XML encryption).
I had no problems with simple types. I just assign them to attributes
of the Python objects representing the XML elements.
`PyXB` does the right thing when it serializes those objects into XML.


More information about the Python-list mailing list