pyxb

PyXB: two versions of XSDs with same namespace

陌路散爱 提交于 2020-01-06 05:51:11
问题 I am implementing a client for the TRIAS APIs v 1.0 and v 1.1 using PyXB. The problem I'm facing is, that both XSD collections have the same namespace with same elements with differing content. So I built two class bindings with pyxbgen for each version. However I now cannot use them both within the same program, since PyXB will throw a pyxb.exceptions_.NamespaceUniquenessError : Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.7/dist

Unable to bind to pyxb classes with nested (anonymous) types

对着背影说爱祢 提交于 2019-12-31 05:08:10
问题 I followed the instructions from this thread, and from this XML: <?xml version="1.0" encoding="UTF-8" ?> <my_report> <something> <foo> Yes </foo> </something> <something_else> <id>4</id> <foo>Finally</foo> <score>0.2</score> </something_else> </my_report> I created the following XSD schema using this tool online. <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="my_report"> <xs:complexType> <xs:sequence>

pyxb UnrecognizedDOMRootNodeError

限于喜欢 提交于 2019-12-11 19:42:33
问题 i've got the following xml schema: <xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:complexType name="DataPackage"> <xsd:sequence> <xsd:element name="timestamp" type="xsd:float" default="0.0"/> <xsd:element name="type" type="xsd:string" default="None"/> <xsd:element name="host" type="xsd:string" default="None"/> <xsd:element name="data" type="Data" /> </xsd:sequence> </xsd:complexType> <xsd:complexType name="Data"

End-to-end example with PyXB. From an XSD schema to an XML document

99封情书 提交于 2019-12-03 05:08:50
问题 I am having a hard time getting started with PyXB. Say I have an XSD file (an XML schema). I would like to: Use PyXB to define Python objects according to the schema. Save those objects to disk as XML files that satisfy the schema. How can I do this with PyXB? Below is a simple example of an XSD file (from Wikipedia) that encodes an address, but I am having a hard time even getting started. <?xml version="1.0" encoding="utf-8"?> <xs:schema elementFormDefault="qualified" xmlns:xs="http://www