1XQ(1) xq man page XQ(1)
2
3
4
6 xq - command-line XML and HTML beautifier and content extractor
7
9 xq [options...] [file]
10
12 Formats the provided file and outputs it in the colorful mode. The
13 file can be provided as an argument or via stdin.
14
16 --version | -v
17 Prints versions information and exits.
18
19 --help | -h
20 Prints the synopsis and a list of options and exits.
21
22 --indent int
23 Uses the given number of spaces for indentation (default 2).
24
25 --no-color
26 Disables colorful output (only formatting).
27
28 --tab
29 Uses tabs instead of spaces for indentation.
30
31 --xpath | -x string
32 Extracts the node(s) from XML using provided XPath query.
33
34 --extract | -e string
35 Extracts a single node from XML using provided XPath query.
36
37 --query | -q string
38 Extracts the node(s) using CSS selector.
39
40 --html | -m
41 Uses HTML formatter instead of XML.
42
43 --node | -n
44 Returns the node content instead of text.
45
47 Format an XML file and highlight the syntax:
48
49 $ xq test/data/xml/unformatted.xml
50
51 Utility also accepts input through stdin:
52
53 $ curl -s https://www.w3schools.com/xml/note.xml | xq
54
55 HTML content can be formatted and highlighted using -m flag:
56
57 $ xq -m test/data/html/formatted.html
58
59 Extract the text content of all nodes with city name:
60
61 $ cat test/data/xml/unformatted.xml | xq -x //city
62
63 Extract the XML content of all nodes with city name:
64
65 $ cat test/data/xml/unformatted.xml | xq -n -x //city
66
68 https://github.com/sibprogrammer/xq - official website
69
70
71
72 06 Nov 2022 XQ(1)