1XQ(1)                             xq man page                            XQ(1)
2
3
4

NAME

6       xq - command-line XML and HTML beautifier and content extractor
7

SYNOPSIS

9       xq [options...] [file]
10

DESCRIPTION

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

OPTIONS

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       --color | -c
26           Forces colorful output.
27
28       --no-color
29           Disables colorful output (only formatting).
30
31       --tab
32           Uses tabs instead of spaces for indentation.
33
34       --xpath | -x string
35           Extracts the node(s) from XML using provided XPath query.
36
37       --extract | -e string
38           Extracts a single node from XML using provided XPath query.
39
40       --query | -q string
41           Extracts the node(s) using CSS selector.
42
43       --attr | -a string
44           Extracts an attribute value instead of node  content  for  provided
45           CSS query.
46
47       --html | -m
48           Uses HTML formatter instead of XML.
49
50       --node | -n
51           Returns the node content instead of text.
52

EXAMPLES

54       Format an XML file and highlight the syntax:
55
56           $ xq test/data/xml/unformatted.xml
57
58       Utility also accepts input through stdin:
59
60           $ curl -s https://www.w3schools.com/xml/note.xml | xq
61
62       HTML content can be formatted and highlighted using -m flag:
63
64           $ xq -m test/data/html/formatted.html
65
66       Extract the text content of all nodes with city name:
67
68           $ cat test/data/xml/unformatted.xml | xq -x //city
69
70       Extract the XML content of all nodes with city name:
71
72           $ cat test/data/xml/unformatted.xml | xq -n -x //city
73

SEE ALSO

75       https://github.com/sibprogrammer/xq - official website
76
77
78
79                                  06 Nov 2022                            XQ(1)
Impressum