ITPub博客

首页 > Linux操作系统 > Linux操作系统 > [20160608]xmllint格式化xml.txt

[20160608]xmllint格式化xml.txt

Linux操作系统 作者:lfree 时间:2016-06-08 22:37:23 0 删除 编辑
[20160608]xmllint格式化xml.txt

$  gpnptool get -o-
<?xml version="1.0" encoding="UTF-8"?><gpnp:GPnP-Profile Version="1.0"
xmlns="http://www.grid-pnp.org/2005/11/gpnp-profile" xmlns:gpnp="http://www.grid-pnp.org/2005/11/gpnp-profile"
xmlns:orcl="http://www.oracle.com/gpnp/2005/11/gpnp-profile" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.grid-pnp.org/2005/11/gpnp-profile gpnp-profile.xsd" ProfileSequence="4"
ClusterUId="7332ecd0a54defd8bf0476778d26d8e1" ClusterName="xxxxxx"
PALocation=""><gpnp:Network-Profile><gpnp:HostNetwork id="gen" HostName="*"><gpnp:Network id="net1" IP="192.168.100.0"
Adapter="bondeth0" Use="public"/><gpnp:Network id="net2" IP="10.10.10.0" Adapter="ib0"
Use="cluster_interconnect"/><gpnp:Network id="net3" IP="10.10.10.0" Adapter="ib1"
Use="cluster_interconnect"/></gpnp:HostNetwork></gpnp:Network-Profile><orcl:CSS-Profile id="css" DiscoveryString="+asm"
LeaseDuration="400"/><orcl:ASM-Profile id="asm" DiscoveryString="o/*/*"
SPFile="+DBFS_DG/xxxxxx/asmparameterfile/registry.253.860619287"/><ds:Signature
xmlns:ds="http://www.w3.org/2000/09/xmldsig#"><ds:SignedInfo><ds:CanonicalizationMethod
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/><ds:Reference URI=""><ds:Transforms><ds:Transform
Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform
Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"> <InclusiveNamespaces
xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="gpnp orcl
xsi"/></ds:Transform></ds:Transforms><ds:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>0tho9n/yT7+TOg3RKi7FXTANqMg=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>XoFD8hpkRJScvOprY56Afcsujl4UdSQfq0whrVlcDRKZ4k7+r3iGvNRQek8VS8rbxIgj3EKGdZxSgmI5xz7jZ+zYYkG7rEfavpCsGVjyjX78jTKlUb+SS1pl1mA9QEHRxR7evaTVsWHkFEdmSt5W6ptM9AT6I/p4+08AkZhP7C8=</ds:SignatureValue></ds:Signature></gpnp:GPnP-Profile>
Success.

--注:这里的输出实际上是一行,我格式化了.实际上使用xmllint很好格式化抽取里面的信息,例子:

$  gpnptool get -o- | xmllint --format - | grep SPFile

Success.
  <orcl:ASM-Profile id="asm" DiscoveryString="o/*/*" SPFile="+DBFS_DG/xxxxxx/asmparameterfile/registry.253.860619287"/>

$  rpm -qa | grep  libxml2
libxml2-2.6.26-2.1.21.0.1.el5_9.3
libxml2-python-2.6.26-2.1.21.0.1.el5_9.3
libxml2-2.6.26-2.1.21.0.1.el5_9.3

--具体的使用可以man xmllint查看.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2117702/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4014
  • 访问量
    7990988