This allows us to fetch strings like the following:
<string name="app_name">foo <xliff:g>bar</xliff:g></string>
Up until now, using .text would only return "foo ", but if we use .tostring()
with the text method, it converts everything into plain text for us resulting
in "foo bar".
def element_content(element):
if element.text is None:
return ""
def element_content(element):
if element.text is None:
return ""
- return element.text.encode('utf-8')
+ return XMLElementTree.tostring(element, encoding='utf-8', method='text')
for path in xmlfiles:
if not os.path.isfile(path):
for path in xmlfiles:
if not os.path.isfile(path):