问题
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