Reputation: 656
I've been trying to get xmlstarlet to add <security-enabled>false</security-enabled>
to "/configuration/core". The command runs without error, but now changes are made to the file.
The XML file:
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd">
<jms xmlns="urn:activemq:jms">
<queue name="DLQ"/>
<queue name="ExpiryQueue"/>
</jms>
<core xmlns="urn:activemq:core">
<!-- this could be ASYNCIO or NIO
-->
<journal-type>ASYNCIO</journal-type>
<paging-directory>./data/paging</paging-directory>
<bindings-directory>./data/bindings</bindings-directory>
<journal-directory>./data/journal</journal-directory>
<large-messages-directory>./data/large-messages</large-messages-directory>
<journal-min-files>10</journal-min-files>
...
</core>
</configuration>
One of the commands I have run:
xmlstarlet ed -i "/configuration/core" -t attr -n "security-enabled" -v "false" broker.xml
I have also used xmlstarlet ed -L ... to edit in place, but when I noticed the edits weren't happening I dropped -L for STDOUT.
Upvotes: 1
Views: 422
Reputation: 2021
You need to specify xml namespace properly. In your case:
xmlstarlet ed -L -N a="urn:activemq" -N c="urn:activemq:core" -s "/a:configuration/c:core" -t elem -n "security-enabled" -v "false" broker.xml
Moreover I changed:
-t attr
to -t elem
since we need element instead of attribute-i
to -s
since we are asking for sub element to be addedUpvotes: 1