From owner-freebsd-arch@FreeBSD.ORG Thu Jul 31 00:25:17 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A38DB554; Thu, 31 Jul 2014 00:25:17 +0000 (UTC) Received: from mail.xcllnt.net (mail.xcllnt.net [50.0.150.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5965A295E; Thu, 31 Jul 2014 00:25:17 +0000 (UTC) Received: from jhayes-sslvpn-nc.jnpr.net ([66.129.239.11]) (authenticated bits=0) by mail.xcllnt.net (8.14.9/8.14.9) with ESMTP id s6V0PERw094606 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 30 Jul 2014 17:25:15 -0700 (PDT) (envelope-from marcel@xcllnt.net) Content-Type: multipart/signed; boundary="Apple-Mail=_48265AB6-342B-4B6A-A5BE-772C31DFAA79"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: XML Output: libxo - provide single API to output TXT, XML, JSON and HTML From: Marcel Moolenaar In-Reply-To: <20140730235123.AC944580A2@chaos.jnpr.net> Date: Wed, 30 Jul 2014 17:25:09 -0700 Message-Id: <06AE7354-CF5D-409F-BCAB-7CD4B728DF15@xcllnt.net> References: <20140725044921.9F0D3580A2@chaos.jnpr.net> <20140728054217.AC1A0580A2@chaos.jnpr.net> <20140728055336.GJ50802@ivaldir.etoilebsd.net> <20140729230345.31E9B580A2@chaos.jnpr.net> <53D85495.4050408@mu.org> <20140730053446.DCE8D580A2@chaos.jnpr.net> <53D944F5.7000207@freebsd.org> <20140730194522.B58FE580A2@chaos.jnpr.net> <20140730235123.AC944580A2@chaos.jnpr.net> To: "Simon J. Gerraty" X-Mailer: Apple Mail (2.1878.6) Cc: Alfred Perlstein , phil@juniper.net, freebsd-arch@freebsd.org X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jul 2014 00:25:17 -0000 --Apple-Mail=_48265AB6-342B-4B6A-A5BE-772C31DFAA79 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On Jul 30, 2014, at 4:51 PM, Simon J. Gerraty wrote: > This looks like the same sort of approach that Juniper used a > over a decade ago for the BSD apps to get XML out, and which we felt was > just too ugly to upstream, I don't see how we could support this. > > Unfortunately it took me a couple of years to get a few hours of Phil's > time, to come up with a neat API to avoid that #ifdef and if/else mess. > On the plus side that means it covers a lot more than just XML. > > We now have an API and library that can avoid the need to double the > cost of adding new output to apps, ie you only write to libxo's api > and it does plain TXT for you if needed. Something that any implementation should handle is that warn(3) and err(3) functions should do the right thing. More precisely: I would expect that the output of a utility when emitting some ML handles both stdout and stderr consistently. Also: I would hope that if we emit XML (for example), we can do so according to a well-defined schema. The GSoC approach seems less likely to have a good solution for those than libxo has. -- Marcel Moolenaar marcel@xcllnt.net --Apple-Mail=_48265AB6-342B-4B6A-A5BE-772C31DFAA79 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlPZjOUACgkQpgWlLWHuifaXRwCeLbL9tbaOdsi++lSRyt1iWTve dHsAoIOco8fBpBMa6TfW8OxC5OHqyG4N =2IhH -----END PGP SIGNATURE----- --Apple-Mail=_48265AB6-342B-4B6A-A5BE-772C31DFAA79--