I have this XML file :
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<feed xml:base="https://receasy1p1942606901trial.hanatrial.ondemand.com:443/rec/Accrual_PO.xsodata/"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://www.w3.org/2005/Atom">
<title type="text">accruals_po</title>
<id>https://receasy1p1942606901trial.hanatrial.ondemand.com:443/rec/Accrual_PO.xsodata/accruals_po</id>
<author>
<name />
</author>
<link rel="self" title="accruals_po" href="accruals_po" />
<entry>
<id>https://receasy1p1942606901trial.hanatrial.ondemand.com:443/rec/Accrual_PO.xsodata/accruals_po('96372537-120')</id>
<title type="text"></title>
<author>
<name />
</author>
<link rel="edit" title="accruals_po" href="accruals_po('96372537-120')"/>
<category term="receasy.accruals_poType" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<content type="application/xml">
<m:properties>
<d:PO_NUMBER m:type="Edm.String">96372537-120</d:PO_NUMBER>
<d:SAP_AMT m:type="Edm.Single">109</d:SAP_AMT>
<d:GL_ACCOUNT m:type="Edm.Int64">65009000</d:GL_ACCOUNT>
<d:COMPANY_CODE m:type="Edm.String">US10_OH</d:COMPANY_CODE>
<d:CONFIRMED_ACCRUAL_AMT m:type="Edm.Single">109</d:CONFIRMED_ACCRUAL_AMT>
<d:FINAL_APPROVER m:type="Edm.String">europe\bamcguir</d:FINAL_APPROVER>
<d:FINAL_GL_ACCOUNT m:type="Edm.Int64">65009000</d:FINAL_GL_ACCOUNT>
<d:FINAL_COMPANY_CODE m:type="Edm.String">US10_OH</d:FINAL_COMPANY_CODE>
<d:RECONCILIATION m:type="Edm.String">Successful</d:RECONCILIATION>
</m:properties>
</content>
</entry>
</feed>
I'm trying to get the values highlighted below in bold, they are under the entry tag.
96372537-120
109
65009000
US10_OH
109
europe\bamcguir
65009000
US10_OH
Successful
This is the code I have as of now to get the values.
import urllib2
import xmltodict
import xml.etree.ElementTree as ET
import requests
tree = ET.parse('export.xml')
root = tree.getroot()
for child in root:
print child.tag, child.attrib
for child2 in child:
print child2.tag, child2.attrib
for child3 in child2:
print child3.tag, child3.attrib
for child4 in child3:
print child4.tag, child4.attrib
for child5 in child4:
print child5.tag, child5.attrib
This is part of the output that I get for PO_NUMBER.
{http://schemas.microsoft.com/ado/2007/08/dataservices}PO_NUMBER {'{http://schemas.microsoft.com/ado/2007/08/dataservices/metadata}type': 'Edm.String'}
I'm not able to get the value of PO_NUMBER which is 96372537-120. How do I get this value, and the other values as highlighted above?