Xmlstarlet using --inplace option in updating xml

假如想象 提交于 2019-12-10 18:52:55

问题


im trying to update one xml tag using --inplace global option as shown below

 xml ed  --inplace -N x="http://java.sun.com/xml/ns/j2ee" -u "//x:web-app/x:filter/x:init-param/x:param-value" -v "/cuadmin/showRecovery.do" WEB-INF/web.xml 

Above is giving me error

**I/O warning : failed to load external entity "x=http%3A//java.sun.com/xml/ns/j2ee"**

The xml im trying to modify looks like below :-

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
  <filter>
    <filter-name>recoveryRedirectFilter</filter-name>
    <filter-class>ClassName</filter-class>
    <init-param>
      <param-name>somename</param-name>
      <param-value>Someurl.do</param-value>
    </init-param>
  </filter>
</web-app>

回答1:


The --inplace option was only added in 1.0.2

xml ed -N x="http://java.sun.com/xml/ns/j2ee" -u "//x:web-app/x:filter/x:init-param/x:param-value" -v "/cuadmin/showRecovery.do" WEB-INF/web.xml > WEB-INF/tmp-web.xml
mv WEB-INF/tmp-web.xml WEB-INF/web.xml


来源:https://stackoverflow.com/questions/18013861/xmlstarlet-using-inplace-option-in-updating-xml

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