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 Extract the node(s) using CSS selector.
39
40 --html | -m
41 Uses HTML formatter instead of XML.
42
44 Format an XML file and highlight the syntax:
45
46 $ xq test/data/xml/unformatted.xml
47
48 Utility also accepts input through stdin:
49
50 $ curl -s https://www.w3schools.com/xml/note.xml | xq
51
52 HTML content can be formatted and highlighted using -m flag:
53
54 $ xq -m test/data/html/formatted.html
55
56 Extract the text content of all nodes with city name:
57
58 $ cat test/data/xml/unformatted.xml | xq -x //city
59
61 https://github.com/sibprogrammer/xq - official website
62
63
64
65 06 Nov 2022 XQ(1)