Skip to content
Advertisement

Tag: xsd

Extracting enumeration values from an XML Schema with Python

From an XML Schema using xmlschema package, I extracted an XsdEnumerationFacets like the one below How can I extract the possible values from it? (‘OP1’, ‘OP2’, ‘OP3’, ‘OP3’, ‘OP4’ and so on in this case). I had one idea to convert it into string (str(enum)), and parse it, but if it’s long, the last elements are not included. (I have

Validating with an XML schema in Python

I have an XML file and an XML schema in another file and I’d like to validate that my XML file adheres to the schema. How do I do this in Python? I’d prefer something using the standard library, but I can install a third-party package if necessary. Answer I am assuming you mean using XSD files. Surprisingly there aren’t

Advertisement