aapost wrote at 2023-1-3 22:57 -0500: > ... >Consider the following: > >from lxml import objectify, etree >schema = etree.XMLSchema(file="path_to_my_xsd_schema_file") >parser = objectify.makeparser(schema=schema, encoding="UTF-8") >xml_obj = objectify.parse("path_to_my_xml_file", parser=parser) >xml_root = xml_obj.getroot() > >let's say I have a Version element, that is defined simply as a string >in a 3rd party provided xsd schema > ><xs:element name="Version" type="xs:string" minOccurs="0">
Does your schema include the third party schema? You might have a look at `PyXB`, too. It tries hard to enforce schema restrictions in Python code. -- https://mail.python.org/mailman/listinfo/python-list