| Main index | Section 1 | Options |
| --close path | |
| Close tags for the given path | |
| --depth num | |
| Set the depth for pretty printing | |
| --help | |
| Display help text | |
| -H | --html | |
| Generate HTML output | |
| -J | --json | |
| Generate JSON output | |
| --leading-xpath path | |
| Add a prefix to generated XPaths (HTML) | |
| --open path | |
| Open tags for the given path | |
| -p | --pretty | |
| Make 'pretty' output (add indent, newlines) | |
| --style style | |
| Generate given style (xml, json, text, html) | |
| -T | --text | |
| Generate text output (the default style) | |
| --version | |
| Display version information | |
| -W | --warn | |
| Display warnings in text on stderr | |
| --warn-xml | |
| Display warnings in xml on stdout | |
| --wrap path | |
| Wrap output in a set of containers | |
| -X | --xml | |
| Generate XML output | |
| --xpath | |
| Add XPath data to HTML output | |
The xo utility accepts a format string suitable for xo_emit(3) and a set of zero or more arguments used to supply data for that string.
In addition, xo accepts any of the libxo options listed in xo_options(7).
% xo 'The {:product} is {:status} stereo "in route"
The stereo is in route
% xo -p -X 'The {:product} is {:status} stereo "in route"
<product>stereo</product>
<status>in route</status>
In this example, the output from a xo command is shown in several styles:
xo "The {k:name} weighs {:weight/%d} pounds. fish 6
TEXT:
The fish weighs 6 pounds.
XML:
<name>fish</name>
<weight>6</weight>
JSON:
"name": "fish",
"weight": 6
HTML:
<div class="line">
<div class="text">The </div>
<div class="data" data-tag="name">fish</div>
<div class="text"> weighs </div>
<div class="data" data-tag="weight">6</div>
<div class="text"> pounds.</div>
</div>
The
xo --wrap top/a/b/c '{:tag}' value
XML:
<top>
<a>
<b>
<c>
<tag>value</tag>
</c>
</b>
</a>
</top>
JSON:
"top": {
"a": {
"b": {
"c": {
"tag": "value"
}
}
}
}
The
#!/bin/sh
xo --open top/data
xo --depth 2 '{tag}' value
xo --close top/data
XML:
<top>
<data>
<tag>value</tag>
</data>
</top>
JSON:
"top": {
"data": {
"tag": "value"
}
}
| XO (1) | December 4, 2014 |
| Main index | Section 1 | Options |
Please direct any comments about this manual page service to Ben Bullock. Privacy policy.
