XMLStarlet不会编辑任何内容

时间:2013-10-09 20:00:53

标签: xml xmlstarlet

我有以下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>    

我正在使用xmlstarlet编辑serverPropertyFile的属性值 以下列方式:

/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

我错过了什么?

找到了答案: 我使用的xpath是错误的,右边的是:

/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

1 个答案:

答案 0 :(得分:1)

语法还可以!这个对我有用 !看看文件的路径,可能是你错过了什么。