Add parameter values to an existing tag in XML



I am trying different ways to add new values to an existing tag in my XML file.


My original XML:



<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"/>
</Service>
</Server>


I want it to transform into:



<Server port="8005" shutdown="SHUTDOWN">
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
scheme="https"
secure="true" SSLEnabled="true"
keyAlias="tomcat" keyPass="welcome"
keystoreFile="/data/matrix/automated-setup/openam.jks"
keystorePass="welcome" clientAuth="false" sslProtocol="TLS"/>
</Service>
</Server>


I don't want to use XSLT here. How can I do it using sed or awk? It has to be added under tag only


No comments:

Post a Comment