Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
xmlstarlet-更新特定节点上的值_Xml_Xpath_Xmlstarlet - Fatal编程技术网

xmlstarlet-更新特定节点上的值

xmlstarlet-更新特定节点上的值,xml,xpath,xmlstarlet,Xml,Xpath,Xmlstarlet,我想通过命令行更新xml文件中的一个值。 我是XmlStartNet的新手,我尝试了以下命令,但它不起作用 xml ed -u "/web-app/welcome-file-list/welcome-file" -v 'Login.jsp' web.xml 在下面的XML文件中,我想在欢迎文件节点上将值更新为login.jsp 这是我的web.xml文件 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http:/

我想通过命令行更新xml文件中的一个值。 我是XmlStartNet的新手,我尝试了以下命令,但它不起作用

xml ed -u "/web-app/welcome-file-list/welcome-file" -v 'Login.jsp' web.xml
在下面的XML文件中,我想在欢迎文件节点上将值更新为login.jsp

这是我的web.xml文件

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <display-name>Struts2 Application</display-name>
  <error-page>
    <error-code>404</error-code>
    <location>/ErrorPage.jsp</location>
  </error-page>
  <error-page>
    <error-code>403</error-code>
    <location>/ErrorPage.jsp</location>
  </error-page>
  <error-page>
    <error-code>500</error-code>
    <location>/ErrorPage.jsp</location>
  </error-page>
  <error-page>
    <exception-type>java.lang.Throwable</exception-type>
    <location>/ErrorPage.jsp</location>
  </error-page>
  <listener>
    <listener-class>com.tcs.bancs.listener.SessionListener</listener-class>
  </listener>
  <!--  Commenting as per discussion -->
  <!-- 
<filter>
    <display-name>CompressionFilter</display-name>
    <filter-name>CompressionFilter</filter-name>
    <filter-class>com.tcs.bancs.web.filter.CompressionFilter</filter-class>

    <init-param>
      <param-name>excludeURI</param-name>
      <param-value>documentDownloadIFADD,</param-value>
    </init-param>

  </filter>
  <filter-mapping>
    <filter-name>CompressionFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  -->
  <!-- WI Auth filter changes by Tuhin -->
  <filter>
    <display-name>WIAuthFilter</display-name>
    <filter-name>WIAuthFilter</filter-name>
    <filter-class>com.tcs.bancs.web.filter.WIAuthFilter</filter-class>
    <init-param>
      <param-name>userHeader</param-name>
      <param-value>OAM_REMOTE_USER</param-value>
    </init-param>
    <init-param>
      <param-name>excludeParam</param-name>
      <param-value>filterCriteria,svgDataForPublishPlan,svgChart,hiddeninvstmntvalue,idHidden2,bankName,clientLabelData,monitoredJson,pageTitleLbl,hiddenVariable3,tableThruResponseMonitored,ToolTip,ReasonsDropBox,confirmSvgData,currencyCombo_Tooltip,cancelInsDescrip,bankingDetailTable_RowValue,editInsDescrip,OneOffEditLink_Title,riskLevelTable,svgDataForReportPlan,paginationData,tableThruResponseLive,tableApplicationPytMthdOne_RowValue,savingsTable_RowValue,lumpsumContributionTableOne_RowValue,paymentTable_RowValue,premiumTable_RowValue,confirmationOfChargesTable_RowValue,fundadviserTable1_RowValue,livesassuredTable_RowValue,lumpsumOriginofwealthTable_RowValue,collectiveSector,transactionData,onBackFlag,hiddenPagination
     ,filterEdit,filtersArrayVal,Filters,chkBoxArrayVal,warningTxtD,warningTxtR,filtersFromCurrent,AssetClassCombo,SectorCombo,RegularWithdrawalJSON,RWJosn,hiddenVariable6,tableThruAjax,documentName</param-value>
    </init-param>
    <init-param>
      <param-name>loginURI</param-name>
      <param-value>/login</param-value>
    </init-param>
    <init-param>
      <param-name>realexURI</param-name>
      <param-value>/RealexServlet.srl</param-value>
    </init-param>
    <init-param>
      <param-name>logoutURI</param-name>
      <param-value>/logout.action</param-value>
    </init-param>
    <!-- downloadURI                               
                               To download static content we should use below path, do not add any other url in this param
                 -->
    <init-param>
      <param-name>downloadURI</param-name>
      <param-value>/_static_contents_/download</param-value>
    </init-param>
    <init-param>
      <param-name>AuthMode</param-name>
      <!-- Modes: 
                                SnROnly - default, only SnR URL will be allowed, 
                                SnRWithBypass- login bypass will be allowd (onsite test), 
                                NoSnR - No SnR, filter will be disabled (Offshore Only) 
                        -->
      <!-- To use SnROnly/ SnRWithBypass we need to make sure 
                            1: jaas config
                                BFS{
                                   com.tcs.bfsarch.security.module.BFSSiteMinderLoginModule required debug=true;
                                };

                            2:MCSystem.prop
                                singleSignon=yes

                            3:DB script change
                               In security_parameter table entry singlesignon=3 for systemid 2(extranet)

                        -->
      <param-value>SnRWithBypass</param-value>
    </init-param>
    <init-param>
      <param-name>logfile</param-name>
      <param-value>E:\BancsProduct\logs\wiauth.log;10M</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>WIAuthFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <filter>
    <display-name>StaticContentFilter</display-name>
    <filter-name>StaticContentFilter</filter-name>
    <filter-class>com.tcs.bancs.web.filter.StaticContentFilter</filter-class>
    <!-- 
     * Parameter Name: staticContextRoot -> the sub context root for static context in the formed virtual path
     * Mandatory
     * Fingerprint (MD5 hash of the file) will follow this sub context root
     -->
    <init-param>
      <param-name>staticContextRoot</param-name>
      <param-value>_static_contents_</param-value>
    </init-param>
    <!-- 
     * Parameter Name: contentTypes -> the comma separate list content type considered for URI replacement in the response body
     * Mandatory
     -->
    <init-param>
      <param-name>contentTypes</param-name>
      <param-value>text/html,text/css,application/javascript,text/plain</param-value>
    </init-param>
    <!-- 

* Parameter Name: CacheExpiryInSeconds -> no of seconds after which cache will expire in browser

* Optional

* Default Value = 31536000 (1 Year) 

-->
    <init-param>
      <param-name>CacheExpiryInSeconds </param-name>
      <param-value> 31536000 </param-value>
    </init-param>
    <!-- 

       * Parameter Name: staticContentExtensions 

       * Optional

       * Default Value = .css,.html,.htm,.pdf,.jpg,.jpeg,.png,.gif,.js

       * Comma seperated list of extension for which the URI replacement will be done


-->
    <init-param>
      <param-name>staticContentExtensions</param-name>
      <param-value>.css,.html,.htm,.pdf,.jpg,.jpeg,.pjpeg,.png,.gif,.js</param-value>
    </init-param>
    <!-- 
     * Parameter Name: maxFileSizeToReplace -> Size in bytes or in KB (K) or MB (M)
     * Optional
     * Default Value = 512M
     * This controls the static file replacement - if any static file is more than specified size,
     * that will not be considered for URI replacement inside the file 9to avoid too much memory consumption)

    <init-param>
      <param-name>maxFileSizeToReplace</param-name>
      <param-value>512M</param-value>
    </init-param>
    -->
    <!-- 
     * Parameter Name: ignoreURIs -> the comma separate list of URIs (exlusive of context root path), which will be ignored for URI replacement inside
     * Optional
     * Default Value = Blank list
     * The URIs mentioned will be skipped URI replacements

    <init-param>
      <param-name>ignoreURIs</param-name>
      <param-value>/path1,/path2</param-value>
    </init-param>
 -->
    <init-param>
      <param-name>ignoreURIs</param-name>
      <param-value>/realexNvgtn</param-value>
    </init-param>
    <!-- 
     * Parameter Name: listNonReplacableURIs -> the comma separate list of URIs (exlusive of context root path), which will not be replaced
     * Optional
     * Default Value = Blank list
     * The URIs mentioned will be not be replaced if used in response as script, CSS or image inclusion
     -->
    <init-param>
      <param-name>listNonReplacableURIs</param-name>
      <param-value>/alfresco.srl</param-value>
    </init-param>
    <!-- 
     * Parameter Name: logfile -> logfile name and size
     * Format : <Logfile path>;Size -> logfile path could be a directory or full path including file name, size could be in bytes, KB (K) or MB (M)
     * Ex : /usr/log/abc.log;10M
     * Optional 
     * Default Value = if nothing specified, logging will be off. If size is not specified or invalidly specified default will be 5MB
     * If file is specified and writable then log will be written in that path. 
     * If the path is directory the "staticfilter.log" file will be created under the path.
     * Log will be rotated after the size reached the size mentioned (default 5MB)
     -->
    <init-param>
      <param-name>logfile</param-name>
      <param-value>E:\BancsProduct\staticfilter.log;10M</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>StaticContentFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!--  CSRF Vulnerability -->
  <filter>
    <filter-name>CSRFShield</filter-name>
    <filter-class>com.tcs.bancs.csrfguard.CSRFShieldFilter</filter-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>WEB-INF/csrfguard.properties</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>CSRFShield</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <!--  CSRF Vulnerability -->
  <!--<filter>
        <filter-name>struts2</filter-name>
        <filter-class>
            org.apache.struts2.dispatcher.FilterDispatcher
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>




 <servlet>
    <servlet-name>WMPInitServlet</servlet-name>
    <servlet-class>com.tcs.wm.servlet.WMPInitServlet</servlet-class>

    <load-on-startup>2</load-on-startup>        
  </servlet>-->
  <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <servlet>
    <servlet-name>WMPInitServlet</servlet-name>
    <servlet-class>com.tcs.wm.servlet.WMPInitServlet</servlet-class>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet>
    <description>
    </description>
    <servlet-name>RealexServlet</servlet-name>
    <servlet-class>
    com.tcs.bancs.realexskandia.RealexServlet</servlet-class>
    <load-on-startup>4</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>RealexServlet</servlet-name>
    <url-pattern>/RealexServlet.srl</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>alfresco</servlet-name>
    <servlet-class>com.tcs.bancs.wcm.servlet.HttpProxyServlet</servlet-class>
    <init-param>
      <param-name>log</param-name>
      <param-value>true</param-value>
    </init-param>
  </servlet>
  <servlet-mapping>
    <servlet-name>alfresco</servlet-name>
    <url-pattern>/alfresco.srl/*</url-pattern>
  </servlet-mapping>
  <servlet>
    <description>
    </description>
    <display-name>
    AplStartup</display-name>
    <servlet-name>AplStartup</servlet-name>
    <servlet-class>
    iims.workflow.util.AplStartup</servlet-class>
    <load-on-startup>4</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>AplStartup</servlet-name>
    <url-pattern>/AplStartup</url-pattern>
  </servlet-mapping>
  <servlet>
    <description>
    </description>
    <display-name>
    DMSStartup</display-name>
    <servlet-name>DMSStartup</servlet-name>
    <servlet-class>
    dms.DMSStartup</servlet-class>
    <load-on-startup>3</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>DMSStartup</servlet-name>
    <url-pattern>/DMSStartup</url-pattern>
  </servlet-mapping>
  <servlet>
    <description>
    </description>
    <display-name>
    IIMSStartup</display-name>
    <servlet-name>IIMSStartup</servlet-name>
    <servlet-class>
    iimsStartup.IIMSStartup</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>IIMSStartup</servlet-name>
    <url-pattern>/IIMSStartup</url-pattern>
  </servlet-mapping>
  <servlet>
    <description>
    </description>
    <display-name>
    IIMSStartupNext</display-name>
    <servlet-name>IIMSStartupNext</servlet-name>
    <servlet-class>
    iimsStartup.IIMSStartupNext</servlet-class>
    <load-on-startup>2</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>IIMSStartupNext</servlet-name>
    <url-pattern>/IIMSStartupNext</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>TreeServlet</servlet-name>
    <servlet-class>iimsStartup.TreeServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>TreeServlet</servlet-name>
    <url-pattern>/TreeServlet</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>30</session-timeout>
  </session-config>
  <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/doc</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>pdf</extension>
    <mime-type>application/pdf</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>csv</extension>
    <mime-type>application/vnd.ms-excel</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>js</extension>
    <mime-type>application/javascript</mime-type>
  </mime-mapping>
  <mime-mapping>
    <extension>png</extension>
    <mime-type>image/png</mime-type>
  </mime-mapping>
  <welcome-file-list>
    <welcome-file>LoginSR.jsp</welcome-file>
  </welcome-file-list>
  <jsp-config>
    <taglib>
      <taglib-uri>/tags/ebw-taglibs</taglib-uri>
      <taglib-location>/WEB-INF/ebwtaglibs.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>/CSRFGuard-taglibs</taglib-uri>
      <taglib-location>/WEB-INF/CSRFGuard.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>/tags/c</taglib-uri>
      <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    <taglib>
      <taglib-uri>/tags/wcm</taglib-uri>
      <taglib-location>/WEB-INF/WCM.tld</taglib-location>
    </taglib>
  </jsp-config>
</web-app>

Struts2应用程序
404
/ErrorPage.jsp
403
/ErrorPage.jsp
500
/ErrorPage.jsp
java.lang.Throwable
/ErrorPage.jsp
com.tcs.bancs.listener.SessionListener
WIAuthFilter
WIAuthFilter
com.tcs.bancs.web.filter.WIAuthFilter
用户头
OAM_远程用户
排除参数
过滤标准、svgDataForPublishPlan、svgChart、HiddenInvstmValue、idHidden2、bankName、clientLabelData、MonitorRedison、PageTitleBL、hiddenVariable3、tableThruResponseMonitored、工具提示、ReasonsDropBox、confirmSvgData、currencyCombo\u工具提示、CancelInsDescriptp、bankingDetailTable\u行值、EditInsDescriptp、OneOffEditLink\u标题、riskLevelTable、svgDataForReportPlan、,分页数据、tableThruResponseLive、tableApplicationPytMthdOne RowValue、储蓄稳定RowValue、总消费贡献表RowValue、paymentTable RowValue、premiumTable RowValue、确认收费表RowValue、基金建议表RowValue、生活保障表RowValue、总消费健康表RowValue、集合部门、交易数据、onBackFlag、,隐藏分页
,filterEdit,FilterArrayVal,Filters,chkBoxArrayVal,WarningXTD,WarningXTR,filtersFromCurrent,AssetClassCombo,SectorCombo,RegularDrawalJSON,RWJosn,hiddenVariable6,tableThruAjax,documentName
罗吉努里酒店
/登录
雷亚莱索里
/RealexServlet.srl
logoutURI
/注销操作
下载URI
/_静态内容/下载
AuthMode
单侧旁路
日志文件
E:\BancsProduct\logs\wiauth.log;10米
WIAuthFilter
/*
静态内容过滤器
静态内容过滤器
com.tcs.bancs.web.filter.StaticContentFilter
staticContextRoot
_静态内容_
内容类型
text/html、text/css、application/javascript、text/plain
缓存过期1秒
31536000
静态内容扩展
.css、.html、.htm、.pdf、.jpg、.jpeg、.pjpeg、.png、.gif、.js
无知者
/realexNvgtn
列表不可恢复URI
/露天的
日志文件
E:\BancsProduct\staticfilter.log;10米
静态内容过滤器
/*
CSRFShield
com.tcs.bancs.csrfguard.CSRFShieldFilter
配置
WEB-INF/csrfguard.properties
CSRFShield
/*
支柱2
org.apache.struts2.dispatcher.ng.filter.strutspreadexecutefilter
支柱2
/*
WMPInitServlet
com.tcs.wm.servlet.WMPInitServlet
2.
RealexServlet
com.tcs.bancs.realexskandia.RealexServlet
4.
RealexServlet
/RealexServlet.srl
露天
com.tcs.bancs.wcm.servlet.HttpProxyServlet
日志
真的
露天
/露天的/*
APL启动
APL启动
iims.workflow.util.AplStartup
4.
APL启动
/APL启动
DMS启动
DMS启动
dms.dms启动
3.
DMS启动
/DMS启动
IIM启动
IIM启动
iimsStartup.iimsStartup
1.
IIM启动
/IIM启动
IIMSStartupNext
IIMSStartupNext
iimsStartup.IIMSStartupNext
2.
IIMSStartupNext
/IIMSStartupNext
小树丛
iimsStartup.TreeServlet
小树丛
/小树丛
30
医生
申请/文件
pdf
申请表格/pdf
csv
应用程序/vnd.ms-excel
js
应用程序/javascript
巴布亚新几内亚
图像/png
LoginSR.jsp
/标记/ebw标记库
/WEB-INF/ebwtaglibs.tld
/CSRFGuard标记库
/WEB-INF/CSRFGuard.tld
/标签/c
/WEB-INF/c.tld
/标签/wcm
/WEB-INF/WCM.tld

它不起作用,因为您的XML位于默认名称空间
http://java.sun.com/xml/ns/javaee

您需要将名称空间绑定到前缀,并在xpath中使用它

例如

xml ed -N x="http://java.sun.com/xml/ns/javaee" -u "/x:web-app/x:welcome-file-list/x:welcome-file" -v 'Login.jsp' web.xml

更多信息。

@Daniel Haley感谢您的编辑。谢谢@Daniel Haley它成功了。我还包括了一个选项-L,用于更新同一文件中的更改。我使用的命令是xml-ed-L-N x=“”-u”/x:web app/x:welcome file list/x:welcome file“-v'Login.jsp'web.xml如果我想更改init param value的值,那么对多个节点的更改该怎么办。。。你能指引我吗