From owner-freebsd-arch@FreeBSD.ORG Mon Aug 4 14:58:33 2014 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 34BD1389; Mon, 4 Aug 2014 14:58:33 +0000 (UTC) Received: from na01-bl2-obe.outbound.protection.outlook.com (mail-bl2lp0206.outbound.protection.outlook.com [207.46.163.206]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "MSIT Machine Auth CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 629D029FF; Mon, 4 Aug 2014 14:58:32 +0000 (UTC) Received: from BL2PR05CA0045.namprd05.prod.outlook.com (10.255.226.45) by BY2PR05MB726.namprd05.prod.outlook.com (10.141.223.19) with Microsoft SMTP Server (TLS) id 15.0.995.14; Mon, 4 Aug 2014 14:58:22 +0000 Received: from BL2FFO11FD045.protection.gbl (2a01:111:f400:7c09::142) by BL2PR05CA0045.outlook.office365.com (2a01:111:e400:c04::45) with Microsoft SMTP Server (TLS) id 15.0.995.14 via Frontend Transport; Mon, 4 Aug 2014 14:58:21 +0000 Received: from P-EMF02-SAC.jnpr.net (66.129.239.16) by BL2FFO11FD045.mail.protection.outlook.com (10.173.161.207) with Microsoft SMTP Server (TLS) id 15.0.990.10 via Frontend Transport; Mon, 4 Aug 2014 14:58:21 +0000 Received: from magenta.juniper.net (172.17.27.123) by P-EMF02-SAC.jnpr.net (172.24.192.21) with Microsoft SMTP Server (TLS) id 14.3.146.0; Mon, 4 Aug 2014 07:58:20 -0700 Received: from idle.juniper.net (idleski.juniper.net [172.25.4.26]) by magenta.juniper.net (8.11.3/8.11.3) with ESMTP id s74Ew5n43616; Mon, 4 Aug 2014 07:58:06 -0700 (PDT) (envelope-from phil@juniper.net) Received: from idle.juniper.net (localhost [127.0.0.1]) by idle.juniper.net (8.14.4/8.14.3) with ESMTP id s74EvXKg019899; Mon, 4 Aug 2014 10:57:39 -0400 (EDT) (envelope-from phil@idle.juniper.net) Message-ID: <201408041457.s74EvXKg019899@idle.juniper.net> To: John-Mark Gurney Subject: Re: XML Output: libxo - provide single API to output TXT, XML, JSON and HTML In-Reply-To: <20140801175906.GA50495@funkthat.com> Date: Mon, 4 Aug 2014 10:57:33 -0400 From: Phil Shafer MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:66.129.239.16; CTRY:US; IPV:NLI; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(6009001)(164054003)(199002)(189002)(110136001)(69596002)(50466002)(53416004)(68736004)(87936001)(4396001)(97736001)(92566001)(80022001)(92726001)(86362001)(74502001)(74662001)(85306004)(102836001)(54356999)(85852003)(103666002)(50986999)(83072002)(107046002)(84676001)(48376002)(47776003)(95666004)(76506005)(6806004)(105596002)(81542001)(81342001)(99396002)(31966008)(64706001)(20776003)(77982001)(46102001)(79102001)(106466001)(76482001)(83322001)(44976005)(81156004)(21056001); DIR:OUT; SFP:; SCL:1; SRVR:BY2PR05MB726; H:P-EMF02-SAC.jnpr.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; MX:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 0293D40691 Received-SPF: SoftFail (protection.outlook.com: domain of transitioning juniper.net discourages use of 66.129.239.16 as permitted sender) Authentication-Results: spf=softfail (sender IP is 66.129.239.16) smtp.mailfrom=phil@juniper.net; X-OriginatorOrg: juniper.net Cc: arch@freebsd.org, Poul-Henning Kamp , "Simon J. Gerraty" , Marcel Moolenaar , Marcel Moolenaar 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: Mon, 04 Aug 2014 14:58:33 -0000 John-Mark Gurney writes: >The just pushed the error handling further down stream... I'd trust >a parse error more than someone handling all the odd edge cases of >missing tags, or even failure to parse the error tag... Yes, I'd rather see output that is obviously broken and prevents a parser (JSON or XML) from returning success than parsable output with a message that we're depending on the client to parse and case about. From phk's example, how many will write: grep --xpath some/tag/i/care/about `du --xml` and not even notice the error tag, which would require something like: grep --xpath 'some[not(//error)]/tag/i/care/about' `du --xml` where the cost of "//error" (searching the entire output tree for an error tag) might be huge. And doing this in JSON would be worse, since there's no XPath for JSON (yet). >Either choice we make pushes the error handling down stream... One case, >it's the parser, the other case it's the consumer of the parser, but in >both cases the downstream HAS to properly handle the error however it >is signaled... Sure, but I'd rather trust the parser library to say "this is junk" than do trust the client app to handle exception information in the output data. Thanks, Phil