I am having a hard time getting started with PyXB.
Let's use this XML file for example:
<?xml version="1.0"?>
<purchaseOrder orderDate="1999-10-20">
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Anytown</city><state>AK</state><zip>12341</zip>
</shipTo>
<billTo country="US">
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<city>Anytown</city><state>AK</state><zip>12341</zip>
</billTo>
</purchaseOrder>
Say if I managed to create the Python library pol.py:
Python code
import po1
xml = open('po1.xml').read()
order = po1.CreateFromDocument(xml)
I understand that I can obtain content within Element (eg. order.billTo.name = Robert Smith), but how do I obtain the value from Attribute "country" (which is "US")?
Thanks in advance!