在 xml 文件中,如果该属性不存在,则使用 shell 脚本将属性附加到节点元素

问题描述

我对使用 Shell 脚本的 xml 文件有以下要求

独立.xml 文件

<?xml version='1.0' encoding='UTF-8'?>
<server xmlns="urn:jboss:domain:11.0">
 <profile>
        <subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
            <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-enabled="false" scan-interval="5000" deployment-timeout="600"/>
        </subsystem>
        ...........Other subsystems tags.......
<server>    

是否要检查节点是否包含“deployment-timeout”属性

if exist read the value then check 
         if the value is <900 
            update the value to 900
         else
            Leave as it is 
else 
    Append attribute with value i.e deployment-timeout="900" to node <deployment-scanner> at the end like this
*<deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-enabled="false" scan-interval="5000" deployment-timeout="900"/>*

Please help me...

advance thanks

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)