Fill XML Macro variables with values
Budget: ₹600 – ₹1,500 INR
Hi, I have a sample xml where many variables are defined in <Macros> tag and the variable used at several places in the xml config. I want to get a python script to convert this xml to an output_xml with all these variables in the xml filled with the variable values defined in the <Macros>. See sample expected input output below :
Example :
input xml :
<HEAD>
<Macros op1="op_one" op2="op_two" ...../> <!-- any number of variables like op1, op2, etc ..
<Port>
<Trd>
<Op name="${op1}"
</Trd>
<Alp alpname="${op2}">
<Op name="${op3}"/>
</Alp>
</Port>
</HEAD>
output xml :
<HEAD>
<Macros op1="op_one" op2="op_two" ...../> <!-- any number of variables like op1, op2, etc ..
<Port>
<Trd>
<Op name="op_one"
</Trd>
<Alp alpname="op_two">
<Op name="op_three"/>
</Alp>
</Port>
</HEAD>
Example :
input xml :
<HEAD>
<Macros op1="op_one" op2="op_two" ...../> <!-- any number of variables like op1, op2, etc ..
<Port>
<Trd>
<Op name="${op1}"
</Trd>
<Alp alpname="${op2}">
<Op name="${op3}"/>
</Alp>
</Port>
</HEAD>
output xml :
<HEAD>
<Macros op1="op_one" op2="op_two" ...../> <!-- any number of variables like op1, op2, etc ..
<Port>
<Trd>
<Op name="op_one"
</Trd>
<Alp alpname="op_two">
<Op name="op_three"/>
</Alp>
</Port>
</HEAD>