Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A simple google search brings this: <a href="http://pyxb.sourceforge.net/userref_pyxbgen.html#pyxbgen">http://pyxb.sourceforge.net/userref_pyxbgen.html#pyxbgen</a></p> <p>In particular the part that says:</p> <blockquote> <p>Translate this into Python with the following command:</p> </blockquote> <pre><code>pyxbgen -u po1.xsd -m po1 </code></pre> <blockquote> <p>The -u parameter identifies a schema document describing contents of a namespace. The parameter may be a path to a file on the local system, or a URL to a network-accessible location like <a href="http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd">http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd</a>. The -m parameter specifies the name to be used by the Python module holding the bindings generated for the namespace in the preceding schema. After running this, the Python bindings will be in a file named po1.py.</p> </blockquote> <p><strong>EDIT</strong> Following your update:</p> <p>Now that you have your generated <code>Address</code> class and all the associated helpers, look at <a href="http://pyxb.sourceforge.net/userref_usebind.html">http://pyxb.sourceforge.net/userref_usebind.html</a> in order to learn how to use them. For your specific question, you want to study the "Creating Instances in Python Code" paragraph. Basically to generate XML from your application data you simply do:</p> <pre><code>import example address = Address() address.FullName = "Jo La Banane" # fill other members of address # ... with open('myoutput.xml', 'w') as file f.write(address.toxml("utf-8")) </code></pre> <p>Now it's up to you to be curious and read the code being generated, pyxb's doc, call the various generated methods and experiment!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload