Akram Ben Aissi
Akram Ben Aissi

Reputation: 370

xmlstarlet to delete wildfly extension or subsystem or value?

I am trying to use xmlstarlet to delete an extension in wildly configuration file aka standalone.xml , but it does not seem to work.

Here is what I do:

 xmlstarlet el -v /tmp/standalone.xml |grep ejb

Which returns me the xpath of the extension I want to delete:

server/extensions/extension[@module='org.jboss.as.ejb3']

Then I try to delete it with "ed -d " , but it remains present:

 xmlstarlet  ed -d 'server/extensions/extension[@module="org.jboss.as.ejb3"]'    /tmp/standalone.xml |head

Any idea ?

Upvotes: 0

Views: 375

Answers (1)

Akram Ben Aissi
Akram Ben Aissi

Reputation: 370

Here is the final solution, which is not hyper intuitive, because it requires to add the namespace prefix for each entity not only at the root level. (We need to repeat the d: prefix at every level of the xpath)

xmlstarlet ed -N d="urn:jboss:domain:5.0" -d "d:server/d:extensions/d:extension[@module='org.jboss.as.ejb3']"   standalone/configuration/standalone.xml

thanks to Aaron also to point out the documentation which gives a few inputs.

Upvotes: 2

Related Questions