mirror of
https://github.com/tldr-pages/tldr.git
synced 2024-11-13 22:51:13 +03:00
bad0110e8a
- fix string example, and improve its description - move xpath information to the main description - add "tags" synonym for "nodes" - add a html example - simplify description of doctype example - capitalize "xml" consistently
28 lines
751 B
Markdown
28 lines
751 B
Markdown
# xmllint
|
|
|
|
> XML parser and linter that supports XPath, a syntax for navigating XML trees.
|
|
|
|
- Return all nodes (tags) named "foo":
|
|
|
|
`xmllint --xpath "//{{foo}}" {{source_file.xml}}`
|
|
|
|
- Return the contents of the first node named "foo" as a string:
|
|
|
|
`xmllint --xpath "string(//{{foo}})" {{source_file.xml}}`
|
|
|
|
- Return the href attribute of the second anchor element in an html file:
|
|
|
|
`xmllint --html --xpath "string(//a[2]/@href)" webpage.xhtml`
|
|
|
|
- Return human-readable (indented) XML from file:
|
|
|
|
`xmllint --format {{source_file.xml}}`
|
|
|
|
- Check that a XML file meets the requirements of its DOCTYPE declaration:
|
|
|
|
`xmllint --valid {{source_file.xml}}`
|
|
|
|
- Validate XML against DTD schema hosted online:
|
|
|
|
`xmllint --dtdvalid {{URL}} {{source_file.xml}}`
|