Check Your Subroutines - We are delivering our latest release to internal test today. Had a code review yesterday. Many issues were found. We are fixing the highest priority probl...
I am starting with the basics. I am using the ElementTree that comes in the Python standard library. It is really easy to parse an XML file in Python. Just takes a few lines of code for ElementTree. The actual parsing is delegated down to a parser program. Expat is such a program that ships with Python.
It is also easy to find or iterate through nodes of interest in the XML. The parsing puts the data in a tree. ElementTree gives you methods to search and destroy. I got hung up for a second because there did not seem to be a method to clone a node. That's okay. I rolled my own.
You need to make sure to do a deepcopy() from the copy module. That way you get the whole node. Then you can append() it to the tree. Make sure to write() the resulting in memory tree back out to an XML file to persist your changes.
Next up I need to figure out which values I need to manipulate in my cloned nodes. Good times I tell you. Good times. No wonder the new guys straight out of college prefer Python for their tools.