How do I update a string attribute with xmlstarlet?

这一生的挚爱 提交于 2019-12-10 16:01:06

问题


$ xmlstarlet edit -L -u "/parse-plugins/mimeType/plugin[@id='parse-html']/@id" -v 'parse-tika' conf/parse-plugins.xml

Why doesn't it replace the plugin id of mimetpes currently using parse-html plugin?

From xmlstarlet documentation:

Update value of an attribute

xml ed -u ’/xml/table/rec[@id=3]/@id’ -v 5 xml/tab-obj.xml

I'm working on nutch parse-plugins.xml.


回答1:


as Mark pointed out, it works! To check that things changed use

$ xmlstarlet sel -t -c "/parse-plugins/mimeType/plugin[@id='parse-html']" conf/parse-plugins.xml

or the last-modified file attribute.



来源:https://stackoverflow.com/questions/5803903/how-do-i-update-a-string-attribute-with-xmlstarlet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!