1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-04 02:15:23 +02:00
tldr/pages/common/xml-elements.md

29 lines
945 B
Markdown
Raw Normal View History

# xml elements
2021-08-23 21:20:17 -04:00
> Extract elements and display the structure of an XML document.
2025-05-11 21:14:19 +03:00
> More information: <https://xmlstar.sourceforge.net/doc/UG/xmlstarlet-ug.html#idm47077139665568>.
- Extract elements from an XML document (producing XPATH expressions):
2025-05-11 21:14:19 +03:00
`xml {{[el|elements]}} {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
- Extract elements and their attributes from an XML document:
2025-05-11 21:14:19 +03:00
`xml {{[el|elements]}} -a {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
- Extract elements and their attributes and values from an XML document:
2025-05-11 21:14:19 +03:00
`xml {{[el|elements]}} -v {{path/to/input.xml|URI}} > {{path/to/elements.xpath}}`
- Print sorted unique elements from an XML document to see its structure:
2025-05-11 21:14:19 +03:00
`xml {{[el|elements]}} -u {{path/to/input.xml|URI}}`
- Print sorted unique elements from an XML document up to a depth of 3:
2025-05-11 21:14:19 +03:00
`xml {{[el|elements]}} -d{{3}} {{path/to/input.xml|URI}}`
- Display help:
2025-05-11 21:14:19 +03:00
`xml {{[el|elements]}} --help`