this patch allows changing, deleting and adding of elements as well as attributes in xml documents like pom.xml or build.xml.
xml-rewrite-2.py -c -a srcdir -v src -m //project/target@[name="compile"]/javac
would change the value of attribute srcdir to "src" only in the 'target' element which attribute 'name' is "compile" following the root //project.
xml-rewrite-2.py -c -a todir -v bin -m target/copy@[todir="pkg"]
would change every 'todir' attribute value to 'bin' which previous value was 'pkg' and is in a 'copy' element surrounded by a 'target' element
furthermore not only matching -m is added but qualification -q
xml-rewrite-2.py -d -a depends -m target -q copy@[todir="win32"]
would delete all 'depends attributes' of 'target' elements wich do include a 'copy' element with an attribute 'todir' with the value 'win32'
Created attachment 303293 [details, diff]
Created attachment 303357 [details, diff]