I’m trying to replace a string in an xml file with python. For example:
I want to change enabled to disbabled in:
<s:global-method-security secured-annotations="enabled"/>
Is it best to search and replace the whole line? Or is there a way to just replaced the enabled on the line if I find a line that matches?
A simple way could be:
You do not need to explicitly find “enabled” in the string before replacing it.
However, since its an xml file, I would suggest using the xml parser to modify it.