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

Simon J. Gerraty sjg at juniper.net
Thu Jul 31 03:22:54 UTC 2014


On Wed, 30 Jul 2014 21:37:54 -0400, Garance A Drosehn writes:
>Do you have links to the library itself?

Not yet.

>I'd suggest that the above isn't quite what one would want, either.
>For the text version it's fine to have a time-of-day value as
>'6:47PM', but if you're going for machine-readable output then

Actually for machine readable output the most useful thing is the utc
seconds.  Eg (in case you don't have access to a Junos router):

root at vjb5> show system uptime | display xml 
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/13.3I0/junos">
    <system-uptime-information xmlns="http://xml.juniper.net/junos/14.2I0/junos">
        <current-time>
            <date-time junos:seconds="1406776765">2014-07-30 20:19:25 PDT</date-time>
        </current-time>

etc.

The patch to w(1) was mostly to demo the API I think.

>It's hard to tell based on your sample output, but there's also
>the question of truncating strings.  In the text output of your
>example, it obviously makes sense to truncate the 'WHAT' value
>to 'ssh svl-junos-d026.juniper.net', but when printing the same
>output in a machine-readable format you wouldn't want to truncate
>it.  Let the application which *reads* the data decide how many
>characters *it* wants to use.

Yes.



More information about the freebsd-arch mailing list