def xml(self):
"""Get XML part of database as string
Returns:
str: XML payload section of database.
"""
return etree.tostring(
self.tree,
pretty_print=True,
standalone=True,
encoding='unicode'
)
To reproduce
kp_db = PyKeePass(filename=db_path, keyfile=key_path, password=token_path.read_text(encoding="utf-8"))
# Hack: Take care of what seems to be a bug in pykeepass when exporting xml
foo = kp_db.xml() #.replace("encoding=''", "encoding='utf-8'")
test = pd.read_xml(encoding="utf-8", path_or_buffer=foo)
Pandas will raise an invalid encoding error since the encoding tag is present, but empty.
bug location in pykeepass.py, line 275
To reproduce
Pandas will raise an invalid encoding error since the encoding tag is present, but empty.