I have a geometadata file
<gmd:MD_Metadata
xmlns:gmd="http://www.isotc211.org/2005/gmd"
xmlns:gco="http://www.isotc211.org/2005/gco" >
<gmd:fileIdentifier>
<gco:CharacterString>2ce585df-df23-45f6-b8e1-184e64e7e3b5</gco:CharacterString>
</gmd:fileIdentifier>
<gmd:language>
<gmd:LanguageCode codeList="https://www.loc.gov/standards/iso639-2/" codeListValue="ger">ger</gmd:LanguageCode>
</gmd:language>
</gmd:MD_Metadata>
Utilizing lxml.objectivy I can parse it easily
from lxml import objectify
data = objectify.parse('rec.xml').getroot()
in data the 'language' is exposed as
(Pdb) data.language.LanguageCode
'ger'
but not the 'fileIdentifier'
(Pdb) data.fileIdentifier.CharacterString
*** AttributeError: no such child: {http://www.isotc211.org/2005/gmd}CharacterString
Obviously lxml is looking in the wrong namespace for "CharacterString".
But the information is there
(Pdb) data.fileIdentifier['{http://www.isotc211.org/2005/gco}CharacterString']
'2ce585df-df23-45f6-b8e1-184e64e7e3b5'
How can I convince lxml to use the correct namespace? Any help appreciated
Volker