XML Output: libxo - provide single API to output TXT, XML, JSON and HTML

Garance A Drosehn drosih at rpi.edu
Wed Jul 30 03:26:13 UTC 2014


On 29 Jul 2014, at 22:12, Alfred Perlstein wrote:
>
> How many utils are converted over at this point?
>
> Have you seen the GSOC project which aims to do this as well?
> "machine readable output from userland utilities" -> 
> https://www.google-melange.com/gsoc/project/details/google/gsoc2014/zarko_korchev/5676830073815040
>
> -Alfred

FWIW, I've been experimenting a bit with something like this for 'lpq'
output, although I'm doing it in a script outside of 'lpq'.  Which is
to say, I haven't tried modifying the code of lpq itself because that's
a real mess to modify due to the way lpq builds each line that it 
prints.

The above URL is just a pointer to the project listing at gsoc.  The 
wiki
page might also be more informative:

https://wiki.freebsd.org/SummerOfCode2014/MachineReadableFromUserlandUtils

although I must admit I don't know how to check what source changes have
been made so far by starting that that wiki entry.

One question that comes up is how to organize the data in the output the
command creates.  For instance, my experiment is just trying to mimic a
rather inefficient process was implemented by some student consultants,
and I wouldn't have organized the JSON object the way they did.  I 
wouldn't
have picked the same names for keys, for instance.  But there are some 
more
complicated issues which come up, due to the fact that one 'lpq' command
can be showing data from multiple processes which are running on 
multiple
hosts, and 'lpq' on the current host can't depend on getting JSON output
from the other hosts or processes that it gets information from.

Given the way lpq's source is organized, I'm also thinking that maybe 
it'd be
better to do this as a separate command, maybe something like 
'lpserialize'.

I personally don't expect unix commands to output HTML, and I find XML a 
bit
unwieldy to work with.  But in my own bikeshed I'm interested in formats 
of
json, yaml, and edn (from the world of Clojure).

In any case, I am interested to see how the GSOC project works out, or
whatever happens with this libxo project.

-- 
Garance Alistair Drosehn                =     drosih at rpi.edu
Senior Systems Programmer               or   gad at FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA


More information about the freebsd-arch mailing list