Search code examples
xmlxmlstarlet

XMLStarlet does not edit anything


i have the following XML:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:objectgrid="http://www.ibm.com/schema/objectgrid"
       xsi:schemaLocation="http://www.ibm.com/schema/objectgrid
            http://www.ibm.com/schema/objectgrid/objectgrid.xsd">

<objectgrid:server id="catlogServer" isCatalog="true"
    serverPropertyFile="location_server_properties_file">
</objectgrid:server> 
</blueprint>    

and i am tring edit the attribute value of serverPropertyFile using xmlstarlet in the following manner:

/tmp/scripts/xmlstarlet ed -N objectgrid=http://www.ibm.com/schema/objectgrid -u "//blueprint/objectgrid:server/@serverPropertyFile" -v '/home/iwuser/att-platform/1.0.10/servers/catalog_demo/config/wxs-catalog-server/catalog-properties/catalog.properties' '/var/tmp/catalog_demo/config/catalog-blueprint.xml' > /var/tmp/temp_xml31651.xml

what am i missing ?

found the answer: the xpath i used is incorrectly the right one is:

/tmp/scripts/xmlstarlet ed -N objectgrid=http://www.ibm.com/schema/objectgrid -u "//objectgrid:server/@serverPropertyFile" -v '/home/iwuser/att-platform/1.0.10/servers/catalog_demo/config/wxs-catalog-server/catalog-properties/catalog.properties' '/var/tmp/catalog_demo/config/catalog-blueprint.xml' > /var/tmp/temp_xml31651.xml

Solution

  • the syntax is Ok ! it works for me ! check out the path of file , may be you missed something.