1273562Smarcellibxo
2273562Smarcel=====
3273562Smarcel
4273562Smarcellibxo - A Library for Generating Text, XML, JSON, and HTML Output
5273562Smarcel
6273562SmarcelThe libxo library allows an application to generate text, XML, JSON,
7273562Smarceland HTML output using a common set of function calls.  The application
8273562Smarceldecides at run time which output style should be produced.  The
9273562Smarcelapplication calls a function "xo_emit" to product output that is
10273562Smarceldescribed in a format string.  A "field descriptor" tells libxo what
11273562Smarcelthe field is and what it means.
12273562Smarcel
13273562Smarcel```
14273562Smarcel    xo_emit(" {:lines/%7ju/%ju} {:words/%7ju/%ju} "
15273562Smarcel            "{:characters/%7ju/%ju}{d:filename/%s}\n",
16273562Smarcel            linect, wordct, charct, file);
17273562Smarcel```
18273562Smarcel
19273562SmarcelOutput can then be generated in various style, using the "--libxo"
20273562Smarceloption: 
21273562Smarcel
22273562Smarcel```
23273562Smarcel    % wc /etc/motd
24273562Smarcel          25     165    1140 /etc/motd
25273562Smarcel    % wc --libxo xml,pretty,warn /etc/motd
26273562Smarcel    <wc>
27273562Smarcel      <file>
28273562Smarcel        <filename>/etc/motd</filename>
29273562Smarcel        <lines>25</lines>
30273562Smarcel        <words>165</words>
31273562Smarcel        <characters>1140</characters>
32273562Smarcel      </file>
33273562Smarcel    </wc>
34273562Smarcel    % wc --libxo json,pretty,warn /etc/motd
35273562Smarcel    {
36273562Smarcel      "wc": {
37273562Smarcel        "file": [
38273562Smarcel          {
39273562Smarcel            "filename": "/etc/motd",
40273562Smarcel            "lines": 25,
41273562Smarcel            "words": 165,
42273562Smarcel            "characters": 1140
43273562Smarcel          }
44273562Smarcel        ]
45273562Smarcel      }
46273562Smarcel    }
47273562Smarcel    % wc --libxo html,pretty,warn /etc/motd
48273562Smarcel    <div class="line">
49273562Smarcel      <div class="text"> </div>
50273562Smarcel      <div class="data" data-tag="lines">     25</div>
51273562Smarcel      <div class="text"> </div>
52273562Smarcel      <div class="data" data-tag="words">    165</div>
53273562Smarcel      <div class="text"> </div>
54273562Smarcel      <div class="data" data-tag="characters">   1140</div>
55273562Smarcel      <div class="text"> </div>
56273562Smarcel      <div class="data" data-tag="filename">/etc/motd</div>
57273562Smarcel    </div>
58273562Smarcel```
59273562Smarcel
60273562SmarcelView the beautiful documentation at:
61273562Smarcel
62273562Smarcelhttp://juniper.github.io/libxo/libxo-manual.html
63274405Smarcel
64274405Smarcel[![Analytics](https://ga-beacon.appspot.com/UA-56056421-1/Juniper/libxo/Readme)](https://github.com/Juniper/libxo)
65