Subject: [netmod] YANG 1.1: XML naming restriction

From: Andy Bierman <[email-masked]>
Date: Sat, 30 Jul 2016 13:10:53 -0700

Hi,

The YANG 1.1 ABNF says:

   ;; An identifier MUST NOT start with (('X'|'x') ('M'|'m') ('L'|'l'))
   identifier          = (ALPHA / "_")
                         *(ALPHA / DIGIT / "_" / "-" / ".")

There is no explanation given why.
The same restriction was copied to RESTCONF, also without explanation.
Supposedly, XML does not allow identifiers to start with XML.

Looks like this restriction only applies to the PITarget [17], not Name [5]
https://www.w3.org/TR/REC-xml/#sec-pi

We have been applying this restriction to element names
but it only applies to processing instructions.

IMO it should be removed.
It confuses people when they get an error for naming a data node
with a string that matches.

Andy

---

From: [email-masked] (Dale R. Worley)
Date: Sun, 31 Jul 2016 21:57:19 -0400

> with a string that matches.

Eh?  Looking at "Extensible Markup Lanuage (XML) 1.0 (Fifth Edition)",
section 3.1 (http://www.w3.org/TR/xml/#sec-starttags) says that the
element name of a start in end tag is a "Name".  Looking at section 2.3
(http://www.w3.org/TR/xml/#sec-common-syn), I see

    Names beginning with the string "xml", or with any string which
    would match (('X'|'x') ('M'|'m') ('L'|'l')), are reserved for
    standardization in this or future versions of this specification.

And since Yang data node names can appear as XML element names, Yang has
to forbid node names that start with "XML".

Dale

---

From: Andy Bierman <[email-masked]>
Date: Sun, 31 Jul 2016 20:22:14 -0700

OK -- sorry -- must have read it wrong

Andy