XML : How to modify a tag text value based on its sibling tag text value in xml with python?

For Eg:

  <parameterDefinitions>          <hudson.model.StringParameterDefinition>            <name>name</name>            <description></description>            <defaultValue>abc</defaultValue>          </hudson.model.StringParameterDefinition>          <hudson.model.BooleanParameterDefinition>            <name>branch</name>            <description></description>            <defaultValue>true</defaultValue>          </hudson.model.BooleanParameterDefinition>  </parameterDefinitions>    

Above given is the small part of XML file which am getting from the Jenkins server. I need to modify the default value(abc and true for the above eg) of the parameters based on its respective name(name and branch).

Have read about MiniDom, Element and ElementTree but couldn't figure out the exact api. Can anyone help me out with this. Thanks in advance.

No comments:

Post a Comment