tldr/pages/common/xml-elements.md

29 lines
885 B
Markdown
Raw Normal View History

# xml elements
2021-08-24 02:20:17 +01:00
> Extract elements and display the structure of an XML document.
2021-08-15 12:19:09 +01:00
> More information: <http://xmlstar.sourceforge.net/docs.php>.
- Extract elements from an XML document (producing XPATH expressions):
2021-08-24 02:20:17 +01:00
`xml elements {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
- Extract elements and their attributes from an XML document:
2021-08-24 02:20:17 +01:00
`xml elements -a {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
- Extract elements and their attributes and values from an XML document:
2021-08-24 02:20:17 +01:00
`xml elements -v {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
- Print sorted unique elements from an XML document to see its structure:
`xml elements -u {{path/to/input.xml|URI}}`
- Print sorted unique elements from an XML document up to a depth of 3:
`xml elements -d{{3}} {{path/to/input.xml|URI}}`
- Display help for the `elements` subcommand:
`xml elements --help`