I was looking this question xmlstarlet update an attribute and trying to replace an attribute inside a Jboss configuration file. I post here just a little part of the xml:
<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:10.0">
<extensions>
<extension module="org.jboss.as.clustering.infinispan"/>
</extensions>
<system-properties>
<property name="hibernate.hbm2ddl.auto" value="validate"/>
</system-properties>
</server>
What i would like to replace is the value of hibernate.hbm2ddl.auto
from validate
to update
Following the previous answer i tried this command, but dont update the value:
xmlstarlet edit --update "//property[@name='hibernate.hbm2ddl.auto']/@value" --value "update" conf.xml
I tried to follow the full path, but the result is the same: no update.
xmlstarlet edit --update "/server/system-properties/property[@name='hibernate.hbm2ddl.auto']/@value" --value "update" conf.xml
Your file uses namespaces (xmlns="urn:jboss:domain:10.0"
).
xmlstarlet edit --update '//*[local-name()="property"][@name="hibernate.hbm2ddl.auto"]/@value' -v "update" conf.xml
I used //*[local-name()="property"]
to bypass all namespaces in conf.xml