如何使用shellscript里解析XML? [英] How to parse XML using shellscript?

查看:166
本文介绍了如何使用shellscript里解析XML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道什么是使用shellscript里解析XML文件的最佳方式?

I would like to know what would be the best way to parse an XML file using shellscript ?


  • 如果一个手工做呢?

  • 是否第三层库中存在?

如果你已经取得它,如果你可以让我知道你们是怎么能做到这

If you already made it if you could let me know how did you manage to do it

推荐答案

您可以尝试 xmllint

该xmllint方案解析一个或多个
  XML文件,在命令中指定
  行XMLFILE。它打印各种
  类型的输出,这取决于
  选项​​中选择。它是有用
  检测误差无论是在XML code和
  在XML解析器ITSE

The xmllint program parses one or more XML files, specified on the command line as xmlfile. It prints various types of output, depending upon the options selected. It is useful for detecting errors both in XML code and in the XML parser itse

它可以让你选择用的XPath的XML文档元素,使用--pattern选项。

It allows you select elements in the XML doc by xpath, using the --pattern option.

在Mac OS X(优胜美地),它被默认安装的。结果
在Ubuntu上,如果尚未安装,您可以运行的apt-get安装的libxml2-utils的

On Mac OS X (Yosemite), it is installed by default.
On Ubuntu, if it is not already installed, you can run apt-get install libxml2-utils

这篇关于如何使用shellscript里解析XML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆