Re: [netmod] Use XML namespaces in YANG document examples
Martin Björklund <mbj+ietf@4668.se> Fri, 04 February 2022 15:15 UTC
Return-Path: <mbj+ietf@4668.se>
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 A79793A16AC; Fri, 4 Feb 2022 07:15:49 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, PDS_NAKED_TO_NUMERO=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=4668.se header.b=AG2uCQ1/; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=m0s4ilTa
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 Eb3FsADag6HQ; Fri, 4 Feb 2022 07:15:43 -0800 (PST)
Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 84ADC3A16AB; Fri, 4 Feb 2022 07:15:41 -0800 (PST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 8590F5C01E7; Fri, 4 Feb 2022 10:15:40 -0500 (EST)
Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 04 Feb 2022 10:15:40 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=4668.se; h=cc:cc :content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; bh=gSVkbkBf07tqeN l4BRplNHj50e9YbZMVqhDIZeCgLUE=; b=AG2uCQ1/CbKL56yZTrK2rWa8eXRGL/ z/TcNUg5z+/fBbfYGzes+IGX3ALb+igdHUrP4DtLfiWeXg3eLOb5CuK6JeWHXfoo BeyPllJqgHCPBZD3YT1ti9J/sC+PPkiyX09WdqUZXYygj8j6OlpduCNwhy3ZcEdB V+mUSV/NmgEN8cFCtndpgboWj+NKomRMr3yhje/ju++mBwNAlNdSVT8AL4U0KDRh 7K/1/uPfSLcLpjECpXc2D0HGgPAnEXCSjMlFkVLz7aqobH7a91p5mtTdOwcP3DN2 Cq5dtcHRY+5s6p4h2y8LklfvX2l9aHdUjPNbTSID+/XnfAhK4QDF/HoA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=gSVkbkBf07tqeNl4BRplNHj50e9YbZMVqhDIZeCgL UE=; b=m0s4ilTancFr7LsdDAQBh9IPUfLXB2BnF/e698PhGymrEMIg8ryv2/F3j mT3lQb0tJTVifDFx3XVQjH5Dpo8SUSFXF8rbW04cLYtBuBYvlbUf8hPCv8CvlWsn j6EiRCUOL71LGfpmIXR1kSDxf22b35YPSpq+lK5FiFU27hAs8paC1KllTMbuR1YN /7tr8OdH2Ob3X7Ua0UEp6dGR7N3qoMsiy5pNpQOOnuxo6RkYGkgMWN+Lcr5ipAhD LFQoGauXf+7Qx7iGjK9P08YvC3kdyuTQRlatYCRxAyIuhxn9v4mZP2x7XPVyKA7J 1odiq4Ju9AuDPgGUzX3UAgHsDdrkg==
X-ME-Sender: <xms:G0P9YXTHDYUhW-EQ_hqVoLnwucfezMClGWyKZwGw7i2nfPAdbA0kPw> <xme:G0P9YYxA9sZwW7ck144GbnSttGwfAaTGwhrmnk1Wr5mKL7ebZqC_i8a-jn3uzY7-q qhG_xSpBHtOVu3JoHQ>
X-ME-Received: <xmr:G0P9Yc2bR9Ukmcn1A3FFfK1vFbKdyX1qQrmE6HVmkc68oIaegMYH-RMFZbmfFbJ8HJ7ShwUIyRKMLH655ahNWS6cYJw-DUP63A>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrgeelgdejgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepfffkvffuhfgjfhfogggtgfesthgsre dtredtjeenucfhrhhomhepofgrrhhtihhnuceujhpnrhhklhhunhguuceomhgsjhdoihgv thhfseegieeikedrshgvqeenucggtffrrghtthgvrhhnpeduieelhefhtddvteffveeike ekheffgfekhedvgfelgfevvddtteetgeeukeduudenucffohhmrghinhepfiefrdhorhhg pdhivghtfhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpehmsghjodhivghtfhesgeeiieekrdhsvg
X-ME-Proxy: <xmx:G0P9YXDwVtF16aLwtHDjqJfLWy-xN900s82CqEQXTJefTTvT6zAgZw> <xmx:G0P9YQjEjEE5QitzJ2p-CMJT5Ac660GaBxKWBZX2UqZk-JwFRDmIpg> <xmx:G0P9YbpDVYmxgKdLL7GRJ9RRXTaptC7U6pPMgoq8IPe_vhJ7jVLq7A> <xmx:HEP9YYfRJcZo8qkFWKQioTfv1auV5fB1TXOg-9bG91uwzuq1sRJ7HA>
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Feb 2022 10:15:38 -0500 (EST)
Date: Fri, 04 Feb 2022 16:15:36 +0100
Message-Id: <20220204.161536.1816358672148417997.id@4668.se>
To: jernej.tuljak@mg-soft.si
Cc: tbray@textuality.com, dhc-chairs@ietf.org, evyncke@cisco.com, netmod@ietf.org, drafts-expert-review@iana.org
From: Martin Björklund <mbj+ietf@4668.se>
In-Reply-To: <866e763b-88ce-ca3f-300a-7f702467fe7c@mg-soft.si>
References: <CAHBU6is235QT3d7q+0xhJHdtVna_9-qjGzHG_P4gnMd6nKtdTw@mail.gmail.com> <20220204.081841.166197909676487568.id@4668.se> <866e763b-88ce-ca3f-300a-7f702467fe7c@mg-soft.si>
X-Mailer: Mew version 6.8 on Emacs 26.3
Mime-Version: 1.0
Content-Type: Text/Plain; charset="utf-8"
Content-Transfer-Encoding: base64
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/xkr5ma5lGB7DBqDrkgZEyEsMNj0>
Subject: Re: [netmod] Use XML namespaces in YANG document examples
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: Fri, 04 Feb 2022 15:15:50 -0000
Jernej Tuljak <jernej.tuljak@mg-soft.si> wrote: > > > On 04/02/2022 08:18, Martin Björklund wrote: > > Tim Bray <tbray@textuality.com> wrote: > >> On Thu, Feb 3, 2022 at 10:21 AM Martin Björklund <mbj+ietf@4668.se> > >> wrote: > >> > >>> If an XML document has <foo xmlns:bar="...">, won't the XML processor > >>> pass the attribute "xmlns:bar" and its value to the application? This > >>> should be enough even if the XML processor doesn't provide a mapping > >>> table between prefix and namespace (it requires more work in the > >>> application of course). > >>> > >> Nope, there's no requirement that they do and some don't. > > Does this mean that an XML processor might not pass attributes in > > general to the application? If so, we might have other similar > > problems. Or does it mean that an XML processor might just not pass > > these "special" attributes? If so, where is that specified? (I tried > > to find this info in the spec, but didn't find it). > > Names that start with "xml" (case insensitive) are reserved by XML 1.0 > specification, "xmlns" in an attribute name included (2.3 Common > Syntactic Constructs). They are special. There is also a guideline on > colon usage within names. Yes, I know. But I can't see that the spec says that attributes w/ reserved names should be treated differently wrt. the application than other attributes. > All processors I'm aware of differentiate between attributes and > namespace attributes in their APIs. What Tim is probably saying is > that some XML processors either don't implement Namespaces in XML 1.0 > or need to be explicitly configured to become "namespace aware". If > not configured as namespace aware, they might simply ignore namespace > attributes therefore not passing them. If they are configured as > namespace aware, they might remove prefix information and pass only > "namespace : local-name" pairs where required (and that excludes text > node content). I guess I wonder if this is b/c the specification says so, or that some implementations choose to do so. /martin > > Jernej > > > > > > > /martin > > > > > >>> I think that if special text is needed for identityref values in XML, > >>> that text should go in to the YANG specification (RFC 7950). All > >>> these other drafts just follow the rules defined in RFC 7950. > >>> > >> Agreed. > >> > >> > >> > >>> > >>> /martin > >>> > >>> > >>> > >>>> > >>>> > >>>> > >>>> > >>>>> > >>>>> Andy > >>>>> > >>>>> > >>>>>> I've excerpted an email exchange with Ian Farrer that I think makes > >>> the > >>>>>> potential problem concrete: > >>>>>> > >>>>>> Hi Ian, I don't think we've met. I'm the grumpy person on the "XML > >>>>>> Directorate" who's been whining about the namespace prefixes in YANG > >>>>>> internet-drafts. One quick issue: I'm a little surprised, is anyone > >>> still > >>>>>> using XML in this kind of thing any more in 2021? > >>>>>> > >>>>>> Anyhow, below I've excerpted the issue that's still troubling me. > >>> Here's > >>>>>> the XML: > >>>>>> > >>>>>> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" > >>>>>> xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type"> > >>>>>> <interface> > >>>>>> <name>eth0</name> > >>>>>> <type>ianaift:ethernetCsmacd</type> > >>>>>> <description>DHCPv6 Relay Interface</description> > >>>>>> <enabled>true</enabled> > >>>>>> </interface> > >>>>>> </interfaces> > >>>>>> > >>>>>> So my question is, I see the XML namespace prefix and the prefix for > >>> the > >>>>>> <type> element content are identical. Is this a coincidence? For > >>> example, > >>>>>> would the following work, changing the namespace prefix to "foo"? > >>>>>> > >>>>>> > >>>>>> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" > >>>>>> xmlns:foo="urn:ietf:params:xml:ns:yang:iana-if-type"> > >>>>>> <interface> > >>>>>> <name>eth0</name> > >>>>>> <type>ianaift:ethernetCsmacd</type> > >>>>>> <description>DHCPv6 Relay Interface</description> > >>>>>> <enabled>true</enabled> > >>>>>> </interface> > >>>>>> </interfaces> > >>>>>> > >>>>>> [if - This example would not work and fails validation with yanglint: > >>>>>> > >>>>>> $ yanglint --strict --verbose -t config -p $IETFYANG > >>>>>> $IETFYANG/iana-if-type.yang $IETFYANG/ietf-interfaces.yang test1.xml > >>>>>> err : Invalid value "ianaift:ethernetCsmacd" in "type" element. > >>>>>> (/ietf-interfaces:interfaces/interface[name='eth0']/type) > >>>>>> ] > >>>>>> > >>>>>> > >>>>>> Follow-up, would the following work, foo for both namespace and > >>> content > >>>>>> prefix? > >>>>>> > >>>>>> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" > >>>>>> xmlns:foo="urn:ietf:params:xml:ns:yang:iana-if-type"> > >>>>>> <interface> > >>>>>> <name>eth0</name> > >>>>>> <type>foo:ethernetCsmacd</type> > >>>>>> <description>DHCPv6 Relay Interface</description> > >>>>>> <enabled>true</enabled> > >>>>>> </interface> > >>>>>> </interfaces> > >>>>>> > >>>>>> Thanks in advance! > >>>>>> > >>>>>> > >>>>>> [if - This does validate with yanglint, however the convention in the > >>>>>> IETF examples I’ve seen seems to be to use the prefix that is defined > >>> in > >>>>>> the original YANG module for imports for consistency, e.g. (from > >>>>>> iana-if-type.yang): > >>>>>> > >>>>>> > >>>>>> On Thu, Feb 3, 2022 at 8:03 AM Andy Bierman <andy@yumaworks.com> > >>> wrote: > >>>>>>> Hi, > >>>>>>> > >>>>>>> I think the text from sec 4 refers to the usage within an > >>> application. > >>>>>>> The XML instance document is the on-the-wire representation and > >>>>>>> the I-D example looks correct. > >>>>>>> > >>>>>>> https://www.w3.org/TR/xml-names/#ns-qualnames > >>>>>>> > >>>>>>> > >>>>>>> Andy > >>>>>>> > >>>>>>> > >>>>>>> On Thu, Feb 3, 2022 at 3:53 AM tom petch <ietfc@btconnect.com> > >>> wrote: > >>>>>>>> From: netmod <netmod-bounces@ietf.org> on behalf of > >>> ianfarrer@gmx.com < > >>>>>>>> ianfarrer@gmx.com> > >>>>>>>> Sent: 03 February 2022 09:37 > >>>>>>>> > >>>>>>>> Hi, > >>>>>>>> > >>>>>>>> A draft I have been working on ( > >>>>>>>> https://datatracker.ietf.org/doc/draft-ietf-dhc-dhcpv6-yang/) > >>> contains > >>>>>>>> a number of XML configuration examples. During the XML expert > >>> review, a > >>>>>>>> question has been raised about the use of XML namespaces in these > >>> examples. > >>>>>>>> I’m raising it here as I don’t have the XML knowledge to answer. > >>>>>>>> > >>>>>>>> <tp> > >>>>>>>> > >>>>>>>> Ian > >>>>>>>> > >>>>>>>> This looks like the issue I raised on this list 14jan2022 with a > >>>>>>>> subject line of > >>>>>>>> XML and prefix > >>>>>>>> although I have not checked that the usage is exactly the same; the > >>>>>>>> 'XML Expert' comment would appear to be. > >>>>>>>> > >>>>>>>> Tom Petch > >>>>>>>> > >>>>>>>> In my example: > >>>>>>>> > >>>>>>>> <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" > >>>>>>>> > >>>>>>>> xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type"> > >>>>>>>> <interface> > >>>>>>>> <name>eth0</name> > >>>>>>>> <type>ianaift:ethernetCsmacd</type> > >>>>>>>> <description>DHCPv6 Relay Interface</description> > >>>>>>>> <enabled>true</enabled> > >>>>>>>> </interface> > >>>>>>>> </interfaces> > >>>>>>>> > >>>>>>>> The question is related to the use of the ‘ianaift:’ prefix. This is > >>>>>>>> quite commonly use in XML examples in YANG documents (e.g. RFC8344) > >>> so I > >>>>>>>> think the question is generally applicable. > >>>>>>>> > >>>>>>>> The specific comments from the expert review are: > >>>>>>>> > >>>>>>>> - > >>>>>>>> For the correct processing of these documents requires that whatever > >>>>>>>> XML software is being used makes available to application code the > >>>>>>>> namespace prefixes. > >>>>>>>> > >>>>>>>> Whilst the recommended tools (e.g. yanglint) provides this > >>> function, it > >>>>>>>> is not an XML best practice. Quoting from the Namespaces in XML, > >>> section 4: > >>>>>>>> "Note that the prefix functions only as a placeholder for a > >>> namespace name. > >>>>>>>> Applications SHOULD use the namespace name, not the prefix, in > >>> constructing > >>>>>>>> names whose scope extends beyond the containing document.” > >>>>>>>> > >>>>>>>> I think that violating a SHOULD assertion in a W3C standard is a > >>>>>>>> problem. > >>>>>>>> > >>>>>>>> There is no requirement for XML processors to provide this prefix > >>>>>>>> information, and software that (quite legally) doesn't, will not > >>> work > >>>>>>>> correctly with YANG documents constructed as specified in this I-D. > >>>>>>>> > >>>>>>>> 1, YANG specifications should note this fact and specify that > >>> software > >>>>>>>> which is used to process YANG documents MUST provide an interface > >>> such that > >>>>>>>> applications can retrieve the prefix-namespace mappings. > >>>>>>>> 2, For constructs such as <type>ianaift:ethernetCsmacd</type> the > >>>>>>>> Internet-Draft should specify that the prefix ("ianaift" in this > >>> case) MUST > >>>>>>>> be identical to the xmlns namespace prefix representing the > >>> namespace name > >>>>>>>> urn:ietf:params:xml:ns:yang:iana-if-type > >>>>>>>> 3, Alternately, the draft could specify that for the namespace > >>>>>>>> urn:ietf:params:xml:ns:yang:iana-if-type, the XML namespace prefix > >>> ianaift > >>>>>>>> MUST be used. Another XML bad practice because software that > >>> generates XML > >>>>>>>> programmatically should feel free to generate synthetic prefixes > >>> without > >>>>>>>> breaking the content, but at least this would solve the problem. > >>>>>>>> - > >>>>>>>> > >>>>>>>> BCP216 (RFC8407 - Guidelines for Authors and Reviewers of Documents > >>>>>>>> Containing YANG modules) doesn’t make any mention of how XML > >>> namespaces > >>>>>>>> should be used, only that example XML/ JSON should be included and > >>> that > >>>>>>>> these examples need to be validated (pyang and yanglint are > >>> mentioned for > >>>>>>>> this). > >>>>>>>> > >>>>>>>> Does this guidance need to be updated to reflect expert review > >>> comments > >>>>>>>> above? > >>>>>>>> > >>>>>>>> Thanks, > >>>>>>>> Ian > >>>>>>>> > >>>>>>>> > >>>>>>>> > >>>>>>>> _______________________________________________ > >>>>>>>> netmod mailing list > >>>>>>>> netmod@ietf.org > >>>>>>>> https://www.ietf.org/mailman/listinfo/netmod > >>>>>>>> > > _______________________________________________ > > netmod mailing list > > netmod@ietf.org > > https://www.ietf.org/mailman/listinfo/netmod >
- [netmod] Use XML namespaces in YANG document exam… ianfarrer
- Re: [netmod] Use XML namespaces in YANG document … tom petch
- Re: [netmod] Use XML namespaces in YANG document … Andy Bierman
- Re: [netmod] Use XML namespaces in YANG document … Tim Bray
- Re: [netmod] Use XML namespaces in YANG document … Mahesh Jethanandani
- Re: [netmod] Use XML namespaces in YANG document … Andy Bierman
- Re: [netmod] Use XML namespaces in YANG document … Carsten Bormann
- Re: [netmod] Use XML namespaces in YANG document … Tim Bray
- Re: [netmod] Use XML namespaces in YANG document … Tim Bray
- Re: [netmod] Use XML namespaces in YANG document … Andy Bierman
- Re: [netmod] Use XML namespaces in YANG document … Martin Björklund
- Re: [netmod] Use XML namespaces in YANG document … Jürgen Schönwälder
- Re: [netmod] Use XML namespaces in YANG document … Tim Bray
- Re: [netmod] Use XML namespaces in YANG document … Tim Bray
- Re: [netmod] Use XML namespaces in YANG document … Jürgen Schönwälder
- Re: [netmod] Use XML namespaces in YANG document … Martin Björklund
- Re: [netmod] Use XML namespaces in YANG document … Jernej Tuljak
- Re: [netmod] Use XML namespaces in YANG document … Ladislav Lhotka
- Re: [netmod] Use XML namespaces in YANG document … Ladislav Lhotka
- Re: [netmod] Use XML namespaces in YANG document … Ladislav Lhotka
- Re: [netmod] Use XML namespaces in YANG document … Martin Björklund
- Re: [netmod] Use XML namespaces in YANG document … ianfarrer
- Re: [netmod] Use XML namespaces in YANG document … Tim Bray
- Re: [netmod] Use XML namespaces in YANG document … Jürgen Schönwälder
- Re: [netmod] Use XML namespaces in YANG document … Tim Bray
- Re: [netmod] Use XML namespaces in YANG document … Jürgen Schönwälder
- Re: [netmod] Use XML namespaces in YANG document … tom petch
- Re: [netmod] Use XML namespaces in YANG document … Carsten Bormann
- Re: [netmod] Use XML namespaces in YANG document … tom petch
- Re: [netmod] Use XML namespaces in YANG document … Carsten Bormann
- Re: [netmod] Use XML namespaces in YANG document … tom petch
- Re: [netmod] Use XML namespaces in YANG document … Andy Bierman
- Re: [netmod] Use XML namespaces in YANG document … tom petch
- Re: [netmod] Use XML namespaces in YANG document … Carsten Bormann
- Re: [netmod] Use XML namespaces in YANG document … Jürgen Schönwälder
- Re: [netmod] Use XML namespaces in YANG document … Andy Bierman
- Re: [netmod] Use XML namespaces in YANG document … Ladislav Lhotka
- Re: [netmod] Use XML namespaces in YANG document … Jan Lindblad (jlindbla)
- Re: [netmod] Use XML namespaces in YANG document … Jürgen Schönwälder
- Re: [netmod] Use XML namespaces in YANG document … Andy Bierman
- Re: [netmod] Use XML namespaces in YANG document … Ladislav Lhotka
- Re: [netmod] Use XML namespaces in YANG document … Rob Wilton (rwilton)
- Re: [netmod] Use XML namespaces in YANG document … tom petch