0
votes

Im using xmlstarlet and trying to insert at subnode under a given node. But how to do it under a node with a given value and not a attribute?

Trying to use this command but insert to many places and will only do it after CCDefines

And not anywhere in the xml where i have /project/configuration/settings/data/option/name

xml ed --subnode "/project/configuration/settings/data/option/name[]/"   -type elem -n state -v "RELEASE" setup.ewp > setup.ewp2

My xml file is:

<project>
  <configuration>
    <settings>
      <data>
        <option>
          <name>CCDefines</name>
          <state>TARGET_R4F</state>
          <state>__little_endian__</state>
        </option>

Hope someone have experience with this.

1

1 Answers

0
votes

To add a subnode to the option node whose name subelement is CCDefines:

xml ed --subnode "/project/configuration/settings/data/option[name = 'CCDefines']" -t elem -n state -v RELEASE setup.ewp