1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/xmllint.md

28 lines
747 B
Markdown
Raw Normal View History

2017-07-14 01:36:12 -07:00
# xmllint
> XML parser and linter.
- Return all nodes named "foo":
`xmllint --xpath "//{{foo}}" {{source_file.xml}}`
- Return as string the contents of first node named "foo":
`xmllint --xpath "string//{{foo}}" {{source_file.xml}}`
- Use other xpath (a syntax for navigating xml trees) expressions for more options in navigating xml tree:
`xmllint --xpath "{{xpath_expression}}" {{source_file.xml}}`
- Return human-readable (indented) xml from file:
`xmllint --format {{source_file.xml}}`
- Check that XML meets requirements of its built-in doctype. This is the part starting with `<!DOCTYPE...>`:
`xmllint --valid {{source_file.xml}}`
- Validate XML against DTD schema hosted online:
`xmllint --dtdvalid {{URL}} {{source_file.xml}}`