[GNC] Python xml library that supports XMLNS for GNC
AC
gnucash at acarver.net
Sun Oct 27 15:55:50 EDT 2024
I need to do a search-and-replace to change one of the sides of a split
from one account to another but only for specific transactions that meet
a criteria. I was trying xml.etree but it did not write out the
namespace correctly so is there another XML library that supports XPath
searching as well as handles GNC's namespace design such that the
written file is correct?
In this case I'm trying to change the account GUID of one half of the
split to a different GUID but only for transactions that match a very
specific description text and have the old GUID as one of the two split
accounts. I already know both the old and new GUIDs but this isn't a
simple search and replace all the GUIDs that match because the account
with the old GUID has transactions that should stay, hence doing XPath
searching to filter down on the specific XML tree elements that match
the criteria.
When I wrote out the XML using xml.etree it wrote namespaces like
'xmlns:ns7', 'xmlns:ns8', etc. even though I had already registered the
namespace at the beginning using what was originally in the GNC XML
file. It did replace some of the namespace data, but not all of it
leaving the 'ns*' names.
More information about the gnucash-user
mailing list