2

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

1 回答 1

1

语法没问题!这个对我有用 !检查文件的路径,可能是你错过了什么。

于 2014-05-22T13:18:14.200 回答