Created
September 11, 2019 23:30
-
-
Save audiodude/ad44f412779de3b802dfbcdd3a5a98f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as Et | |
tree = Et.ElementTree(file = 'test.xml') | |
root = tree.getroot() | |
for child in root: | |
for grandchild in child: | |
print(grandchild.findall('.//Raw_Material')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<XML_Order order_Id='1' terms='Net30' ship_via='UPS'> | |
<Line_Items> | |
<Line_Item upc='1234567' item_id='1' color='blk' qty='15'> | |
<Raw_Materials> | |
<Raw_Material Item_Id='H188' Vendor_Id='DI0001'/> | |
<Raw_Material Item_Id='ST03' Vendor_Id='DI0001'/> | |
</Raw_Materials> | |
</Line_Item> | |
<Line_Item upc='12345678' item_id='1' color='blk' qty='15'> | |
<Raw_Materials> | |
<Raw_Material Item_Id='H188' Vendor_Id='F10001'/> | |
<Raw_Material Item_Id='ST03' Vendor_Id='FI0001'/> | |
</Raw_Materials> | |
</Line_Item> | |
</Line_Items> | |
</XML_Order> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment