Latest recipes tagged "objectify"http://code.activestate.com/recipes/tags/objectify/new/2014-12-05T04:39:51-08:00ActiveState Code RecipesObjectify of a XML node (Python)
2014-12-05T04:39:51-08:00Thomas Lehmannhttp://code.activestate.com/recipes/users/4174477/http://code.activestate.com/recipes/578976-objectify-of-a-xml-node/
<p style="color: grey">
Python
recipe 578976
by <a href="/recipes/users/4174477/">Thomas Lehmann</a>
(<a href="/recipes/tags/objectify/">objectify</a>, <a href="/recipes/tags/xml/">xml</a>).
</p>
<p>The script allows you to convert a XML node into an object instance that has the XML node attributes as fields with the given values. The values are converted (when possible):</p>
<ul>
<li>from string to int</li>
<li>from string to float</li>
<li>or remain as string</li>
</ul>
<p>You also initially can provide a dictionary of (key,value) to ensure existence of certain fields which might not be provided by the XML node but on the other hand those values might be overwritten by the XML node.</p>
<p>Please have a look at the docstring for the example ...</p>