-->

使用XML xmlstarlet提取值(Extract values from XML using

2019-09-17 13:53发布

我怎么可以提取使用xmlstarlet本地端口从这个XML例子:

<?xml version="1.0"?>
<opmn xmlns="http://www.oracle.com/ias-instance">
<notification-server>
<port local="6101" remote="6200" request="6003"/>
<log-file path="$ORACLE_HOME\opmn\logs\ons.log" level="4" rotation-size="1500000"/>
<ssl enabled="true" wallet-file="$ORACLE_HOME\opmn\conf\ssl.wlt\default"/>
</notification-server>
</opmn>

Answer 1:

xml sel -N ias=http://www.oracle.com/ias-instance -t -v //ias:port/@local example.xml

或者更精确

xml sel -N ias=http://www.oracle.com/ias-instance -t -v /ias:opmn/ias:notification-server/ias:port/@local example.xml


文章来源: Extract values from XML using xmlstarlet
标签: xmlstarlet