Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nebuxadnezzar/xml-tag-extractor
Extracts a XML document between a set of tags and transforms it into single line document
https://github.com/nebuxadnezzar/xml-tag-extractor
xml xml-parser xml-parsing xml-stream-parser xml-tags
Last synced: about 2 months ago
JSON representation
Extracts a XML document between a set of tags and transforms it into single line document
- Host: GitHub
- URL: https://github.com/nebuxadnezzar/xml-tag-extractor
- Owner: nebuxadnezzar
- Created: 2024-06-25T17:17:44.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-31T01:20:42.000Z (5 months ago)
- Last Synced: 2024-07-31T04:07:34.974Z (5 months ago)
- Topics: xml, xml-parser, xml-parsing, xml-stream-parser, xml-tags
- Language: Go
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# xml-tag-extractor
Extracts a XML document between a set of tags and transforms it into single line document### Command line
```textUsage: xte [OPTIONS] XML-file-path
OPTIONS:
-boost
boost processing, helps big file processing
-ca
-convert.attributes
convert attributes to elements
-h
-help
show help
-ol
-one.liner
transform XML document into one-liner-rt string
-root.tag string
add provided root tags to each document to make correct XML document-xp string
-xml.paths string
CSV list of paths to tag(s) to extract, i.e. root:greeting OR root:greetings,root:story```
### Examples
given this file
```xmlhello
good bye 3
wide```
... to extract ```greetings``` tags together with its content use command
```bash
xte -ol -xp root:greetings my.xml
```
the output will be one-document-per-line records
```xml
hello
good bye 3```
to extract ```times``` tags together with its content use command
```bash
xte xte -ol -xp root:greetings:times my.xml
```if not __tag-path__ argument provided __xte__ will print all tag paths and their count found in an XML file which can be useful, if you have huge file and don't know XML structure of the file.
```xml
xte my.xml
```
```
root 1
root:greetings 3
root:greetings:times 1
root:smiles 1```
### Notes
>__xte__ doesn't parse out and convert attributes to elements. this will be next feature