libxo - A Library for Generating Text, XML, JSON, and HTML Output¶
The libxo library allows an application to generate text, XML, JSON, and HTML output, suitable for both command line use and for web applications. The application decides at run time which output style should be produced. By using libxo, a single source code path can emit multiple styles of output using command line options to select the style, along with optional behaviors. libxo includes support for multiple output streams, pluralization, color, syslog, humanized(3) output, internationalization, and UTF-8. The library aims to minimize the cost of migrating code to libxo.
libxo ships as part of FreeBSD.
- Introducing libxo
- Getting libxo
- Formatting with libxo
- Command-line Arguments
- Format Strings
- Field Roles
- Field Modifiers
- The Argument Modifier ({a:})
- The Colon Modifier ({c:})
- The Display Modifier ({d:})
- The Encoding Modifier ({e:})
- The Gettext Modifier ({g:})
- The Humanize Modifier ({h:})
- The Key Modifier ({k:})
- The Leaf-List Modifier ({l:})
- The No-Quotes Modifier ({n:})
- The Plural Modifier ({p:})
- The Quotes Modifier ({q:})
- The Trim Modifier ({t:})
- The White Space Modifier ({w:})
- Field Formatting
- The libxo API
- Encoders
- The “xo” Utility
- ‘A percent sign appearing in text is a literal’
- ‘Unknown long name for role/modifier’
- ‘Last character before field definition is a field type’
- ‘Encoding format uses different number of arguments’
- ‘Only one field role can be used’
- ‘Potential missing slash after C, D, N, L, or T with format’
- ‘An encoding format cannot be given (roles: DNLT)’
- ‘Format cannot be given when content is present (roles: CDLN)’
- ‘Field has color without fg- or bg- (role: C)’
- ‘Field has invalid color or effect (role: C)’
- ‘Field has humanize modifier but no format string’
- ‘Field has hn-* modifier but not ‘h’ modifier’
- ‘Value field must have a name (as content)”)’
- ‘Use hyphens, not underscores, for value field name’
- ‘Value field name cannot start with digit’
- ‘Value field name should be lower case’
- ‘Value field name should be longer than two characters’
- ‘Value field name contains invalid character’
- ‘decoration field contains invalid character’
- ‘Anchor content should be decimal width’
- ‘Anchor format should be “%d”’
- ‘Anchor cannot have both format and encoding format”)’
- ‘Max width only valid for strings’
- xohtml
- xopo
- FAQs
- Howtos: Focused Directions
- Examples