1LIBXO(3) BSD Library Functions Manual LIBXO(3)
2
4 xo_set_info — set the field information data for libxo
5
7 library “libxo”
8
10 #include <libxo/xo.h>
11
12 void
13 xo_set_info(xo_handle_t *handle, xo_info_t *info, int count);
14
16 HTML data can include additional information in attributes that begin
17 with "data-". To enable this, three things must occur:
18
19 First the application must build an array of xo_info_t structures, one
20 per tag. The array must be sorted by name, since libxo uses a binary
21 search to find the entry that matches names from format instructions.
22
23 The xo_info_t structure is defined in <libxo/xo.h>:
24
25 typedef struct xo_info_s {
26 const char *xi_name; /* Name of the element */
27 const char *xi_type; /* Type of field */
28 const char *xi_help; /* Description of field */
29 } xo_info_t;
30
31 Second, the application must inform libxo about this information using
32 the xo_set_info() call. Like other libxo calls, passing NULL for the
33 handle tells libxo to use the default handle.
34
35 If the count is -1, libxo will count the elements of info, but there must
36 be an empty element at the end. More typically, the number is known to
37 the application:
38
39 xo_info_t info[] = {
40 { "in-stock", "number", "Number of items in stock" },
41 { "name", "string", "Name of the item" },
42 { "on-order", "number", "Number of items on order" },
43 { "sku", "string", "Stock Keeping Unit" },
44 { "sold", "number", "Number of items sold" },
45 };
46 int info_count = (sizeof(info) / sizeof(info[0]));
47 ...
48 xo_set_info(NULL, info, info_count);
49
50 Third, the emission of info must be triggered with the XOF_INFO flag us‐
51 ing either the xo_set_flags() function or the “--libxo=info” command line
52 argument.
53
54 The type and help values, if present, are emitted as the "data-type" and
55 "data-help" attributes:
56
57 <div class="data" data-tag="sku" data-type="string"
58 data-help="Stock Keeping Unit">GRO-000-533</div>
59
61 xo_emit(3), libxo(3)
62
64 The libxo library first appeared in FreeBSD 11.0.
65
67 libxo was written by Phil Shafer <phil@freebsd.org>.
68
69
71 FreeBSD uses libxo version 1.6.0. Complete documentation can be found on
72 github:
73
74 https://juniper.github.io/libxo/1.6.0/html/index.html
75
76 libxo lives on github as:
77
78 https://github.com/Juniper/libxo
79
80 The latest release of libxo is available at:
81
82 https://github.com/Juniper/libxo/releases
83
85 The libxo library was added in FreeBSD 11.0.
86
88 Phil Shafer
89
90BSD December 4, 2014 BSD