The xml I need to search specifies but does not use a namespace:
<WRMHEADER xmlns="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" version="4.0.0.0">
<DATA>
<PROTECTINFO>
<KEYLEN>16</KEYLEN>
<ALGID>AESCTR</ALGID>
</PROTECTINFO>
<LA_URL>http://192.168.8.33/license/rightsmanager.asmx</LA_URL>
<LUI_URL>http://192.168.8.33/license/rightsmanager.asmx</LUI_URL>
<DS_ID></DS_ID>
<KID></KID>
<CHECKSUM></CHECKSUM>
</DATA>
</WRMHEADER>
I'd like to read the values for various fields, e.g. data/protectinfo/keylen etc.
root = ET.fromstring(sMyXml)
keylen = root.findall('./DATA/PROTECTINFO/KEYLEN')
print root
print keylen
This code prints the following:
<Element {http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader}WRMHEADER at 0x7f2a7c35be60>
[]
root.find and root.findall return None or [] for this query. I've been unable to specify a default namespace, is there a solution to querying these values? thanks