1

I am attempting to use xmlstarlet to replace key data points in this xml file with variables from other files (ips, dist name, zulu time, etc) but get a namespace error because its not absolute. I removed the top 3 lines and still can't seem to get it to update.

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE raml SYSTEM 'raml20.dtd'>
<raml version="2.0" xmlns="raml20.xsd">
^ Removed lines from create.xml

  <cmData type="plan" scope="all" name="TestPlan1" id="PlanConfiguration( 234 )">
    <header>
      <log dateTime="zulu_time" action="created" appInfo="PlanExporter">InternalValues are used</log>
    </header>
    <managedObject class="ACCESSNETW" version="18.5" distName="du_name" id="id_num" operation="create">
      <defaults name="System"/>
      <p name="network">5</p>
      <p name="privilegedSender">1</p>
      <p name="range">1.1.1.1/8</p>
      <p name="remark">Fiber</p>
    </managedObject>
  </cmData>
</raml>

The code I try is:

[root@machine templates]# xmlstarlet ed -u "/cmData/header/log[@dateTime='zulu_time']/@value" -v "new_time_here" create.xml
<?xml version="1.0"?>
<cmData type="plan" scope="all" name="plan_name" id="PlanConfiguration( 234 )">
  <header>
    <log dateTime="zulu_time" action="created" appInfo="PlanExporter">InternalValues are used</log>
  </header>
  <managedObject class="ACCESSNETW" version="18.5" distName="du_name" id="id_num" operation="create">
    <defaults name="System"/>
    <p name="network">5</p>
    <p name="privilegedSender">1</p>
    <p name="range">1.1.1.1</p>
    <p name="remark">Fiber</p>
  </managedObject>
</cmData>
Cyrus
  • 84,225
  • 14
  • 89
  • 153
DcMasta
  • 11
  • 1

0 Answers0