Re: [netmod] Whitespace in XML encoding - allowed ?

Ladislav Lhotka <lhotka@nic.cz> Tue, 09 October 2018 10:37 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 8E29913125E for <netmod@ietfa.amsl.com>; Tue, 9 Oct 2018 03:37:59 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.899
X-Spam-Level:
X-Spam-Status: No, score=-1.899 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mxog1y-Eoofm for <netmod@ietfa.amsl.com>; Tue, 9 Oct 2018 03:37:56 -0700 (PDT)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 6B6BE131250 for <netmod@ietf.org>; Tue, 9 Oct 2018 03:37:55 -0700 (PDT)
Received: by trail.lhotka.name (Postfix, from userid 109) id 554CE1821139; Tue, 9 Oct 2018 12:45:42 +0200 (CEST)
Received: from localhost (nat-2.nic.cz [217.31.205.2]) by trail.lhotka.name (Postfix) with ESMTPSA id D7D161821137; Tue, 9 Oct 2018 12:45:26 +0200 (CEST)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Balázs Lengyel <balazs.lengyel@ericsson.com>, "netmod@ietf.org" <netmod@ietf.org>
In-Reply-To: <14e78aaa-4508-970a-d1a0-e091ffaf5c8e@ericsson.com>
References: <14e78aaa-4508-970a-d1a0-e091ffaf5c8e@ericsson.com>
Mail-Followup-To: Balázs Lengyel <balazs.lengyel@ericsson.com>, "netmod\@ietf.org" <netmod@ietf.org>
Date: Tue, 09 Oct 2018 12:37:37 +0200
Message-ID: <871s8zh0cu.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/JsrSrAscw92IEuZQh8CIsH_a08Y>
Subject: Re: [netmod] Whitespace in XML encoding - allowed ?
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Oct 2018 10:38:00 -0000

Balázs Lengyel <balazs.lengyel@ericsson.com> writes:

> Hello,
>
> Recently we came up against a problem where a certain implementation did not accept the
> following:
>
> <with-defaults xmlns="...">
>     report-all
> </with-defaults>
>
> while it did accept 
>
> <with-defaults xmlns="...">report-all</with-defaults>

The "with-defaults" leaf is modelled as an enumeration in RFC 6243
(sec. 5), so the lexical representation is the assigned name,
i.e. "report-all". So the behaviour above is correct according to the
spec.

On the other hand, this looks like a good place for applying the Postel
principle because enum names must not have any leading or trailing
whitespace, so no confusion can ever arise if this whitespace is
stripped.

Lada

>
> I am unsure whether YANG's XML encoding allows whitespace before and after a leaf's value? In
> RFC7950 it does not say yes or no. I have found the following examples that seem to allow
> preceding/following whitespace:
>
> https://tools.ietf.org/html/rfc7950#section-4.2.9
>
>        <status xmlns="http://example.com/system">
>          The image example-fw-2.3 is being installed.
>        </status>
>
> https://tools.ietf.org/html/rfc7950#section-7.16.3
>
>          <reporting-entity>
>            /ex:interface[ex:name='Ethernet0']
>          </reporting-entity>
>
> https://tools.ietf.org/html/rfc6243#appendix-A.3.1
>
>         <with-defaults
>          xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults">
>           report-all
>         </with-defaults>
>
> It is problematic that this is not clarified. IMHO this should be clarified in an errata to rfc7950.
> Chose one:
>
> 1 It is not allowed to add preceding or following whitespace after the value of a leaf/leaf-list. 
>  Note that some text documents may add whitespace to Netconf examples to avoid long
>  lines, 
>  however this extra whitespace MUST NOT be present in the actual Netconf encoding.
> 2 It is not allowed to add preceding or following whitespace after the value of a leaf/leaf-list.
> 3 It is allowed to add preceding or following whitespace after the value of a leaf/leaf-list except
>  for string based types, where the whitespace could be part of the leaf's value itself..
>
> What do you think?
>
> regards Balazs
>
> -- 
> Balazs Lengyel                       Ericsson Hungary Ltd.
> Senior Specialist
> Mobile: +36-70-330-7909              email: Balazs.Lengyel@ericsson.com 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod

-- 
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67