Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/orangewise/xml-get

get values from xml
https://github.com/orangewise/xml-get

cli get lodash npm xml

Last synced: 8 days ago
JSON representation

get values from xml

Awesome Lists containing this project

README

        

# xml-get

[![npm version][npm-badge]][npm-url]
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

Command line program to get values from xml using lodash.get paths.

# usage

Given a the xml file below, you can get values like:

```bash
$ npx xml-get planes_for_sale.ad[0].year ./test/fixtures/one.xml
1977

# output json, can be piped into jq
$ npx xml-get planes_for_sale.ad[0].year ./test/fixtures/one.xml json | jq .
"1977"

$ npx xml-get planes_for_sale.ad[1].location.state ./test/fixtures/one.xml
Missouri

$ cat ./test/fixtures/one.xml | npx xml-get planes_for_sale.ad[0].color
Light blue and white
```

## xml file

```xml



1977
&c;
Skyhawk
Light blue and white
New paint, nearly new interior,
685 hours SMOH, full IFR King avionics
23,495
Skyway Aircraft

Rapid City,
South Dakota



1965
&p;
Cherokee
Gold
240 hours SMOH, dual NAVCOMs, DME,
new Cleveland brakes, great shape

John Seller

St. Joseph,
Missouri


```

[npm-badge]: https://badge.fury.io/js/xml-get.svg
[npm-url]: https://badge.fury.io/js/xml-get