Subject: Re: [netmod] YANG 1.1: XML naming restriction

From: William Lupton <[email-masked]>
Date: Mon, 1 Aug 2016 09:15:23 +0100

But the errata at https://www.w3.org/XML/xml-V10-5e-errata <https://www.w3.org/XML/xml-V10-5e-errata> say the following. There are also related changes to Section 2.6 (processing instructions) and Section 3 (logical structures). W.
Section 2.3 Common Syntactic Constructs <http://www.w3.org/TR/REC-xml/#sec-common-syn>
Delete the following paragraph:

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.

> On 1 Aug 2016, at 04:22, Andy Bierman <[email-masked]> wrote:
> 
> 
> OK -- sorry -- must have read it wrong
> 
> 
> Andy
> 
> 
> 
> On Sun, Jul 31, 2016 at 6:57 PM, Dale R. Worley <[email-masked] <mailto:[email-masked]>> wrote:
> Andy Bierman <[email-masked] <mailto:[email-masked]>> writes:
> > 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 <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.
> 
> Eh?  Looking at "Extensible Markup Lanuage (XML) 1.0 (Fifth Edition)",
> section 3.1 (http://www.w3.org/TR/xml/#sec-starttags <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 <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
> 
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod

---

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 1 Aug 2016 10:38:40 +0200

> On 01 Aug 2016, at 10:15, William Lupton <[email-masked]> wrote:
> 
> But the errata at https://www.w3.org/XML/xml-V10-5e-errata say the following. There are also related changes to Section 2.6 (processing instructions) and Section 3 (logical structures). W.
> Section 2.3 Common Syntactic Constructs

Good catch! What this erratum means for YANG is that only "xml" prefix needs to be forbidden.

If it is still possible, it would IMO make a good sense to remove that comment from the ABNF in 6020bis, and make this change in sec. 7.1.4:

OLD

   A prefix is an identifier (see Section 6.2).

NEW

   A prefix is an identifier (see Section 6.2), and it MUST NOT be the string "xml".

Lada 

>> On Sun, Jul 31, 2016 at 6:57 PM, Dale R. Worley <[email-masked]> wrote:
>> Andy Bierman <[email-masked]> writes:
>> > The YANG 1.1 ABNF says:
>> >
>> > https://www.w3.org/TR/REC-xml/#sec-pi
>> >
>> section 3.1 (http://www.w3.org/TR/xml/#sec-starttags) says that the
>> (http://www.w3.org/TR/xml/#sec-common-syn), I see
>> 

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C

---

From: [email-masked] (Dale R. Worley)
Date: Mon, 01 Aug 2016 10:51:49 -0400

William Lupton <[email-masked]> writes:
> But the errata at https://www.w3.org/XML/xml-V10-5e-errata
> <https://www.w3.org/XML/xml-V10-5e-errata> say the following. There
> are also related changes to Section 2.6 (processing instructions) and
> Section 3 (logical structures).

>> Names beginning with the string "xml", or with any string which would
>> match (('X'|'x') ('M'|'m') ('L'|'l')), are reserved for

Hmmm, I'd not heard of that.  But let me also quote this part of the
same errata, which is the new version of section 3:

>> This specification does not constrain the application semantics, use,
>> or (beyond syntax) names of the element types and attributes, except
>> that names beginning with "xml:" are reserved for standardization in
>> this or future specifications from the XML Core Working Group or its
>> successors.

If I read everything correctly, the only reserved names are now:

- beginning with "xml:" (the revised XML spec)
- the attribute "xmlns" (XML Namespaces spec)
- attributes beginning "xmlns:" (XML Namespaces spec)
- the attributres "xml:base" and "xml:id" (other XML specs, per Wikipedia)

And it seems that the only way to use Yang to cause the creation of an
XML name that violates those rules is to define a prefix "xml", which
will appear on element names.  But maybe even that one exclusion isn't
true, since the use of a Yang prefix as an XML namespace name is not
mandatory; the processor is allowed to use a different prefix if there
is a "conflict".  (6020bis, section 7.1.4)

Dale

---

From: Phil Shafer <[email-masked]>
Date: Mon, 1 Aug 2016 17:21:19 -0400

Ladislav Lhotka writes:
>If it is still possible, it would IMO make a good sense to remove that comment from the 
>ABNF in 6020bis, and make this change in sec. 7.1.4:
>
>OLD
>

Should it call out "xmlns" also?

The original "xml" prohibition likely dates from JUNOS, where we
encoded insert requests using the identifier name as the attribute
(not yang:key), so element names followed the same rules as attributes.

http://www.juniper.net/techpubs/en_US/junos14.2/topics/task/configuration/junos-xml-protocol-configuration-data-elements-reordering.html

<configuration>
    <!-- opening tag for each parent of the set -->
        <ordered-set insert="(before | after)" identifier1="referent-value"
                        identifier2="referent-value"> 
            <identifier1>value-for-moving-object</identifier1> 
            <identifier2>value-for-moving-object</identifier2> 
        </ordered-set> 
    <!-- closing tag for each parent of the set -->
</configuration>

Thanks,
 Phil

---

From: Martin Bjorklund <[email-masked]>
Date: Wed, 17 Aug 2016 14:34:48 +0200 (CEST)

Ladislav Lhotka <[email-masked]> wrote:
> > But the errata at https://www.w3.org/XML/xml-V10-5e-errata say the
> > following. There are also related changes to Section 2.6 (processing
> > instructions) and Section 3 (logical structures). W.
> Good catch!

Indeed!

> What this erratum means for YANG is that only "xml" prefix
> needs to be forbidden.

Actually, as Dale Worley pointed out, not even this is required, since
the prefix is not required to be used in the XML encoding.

I suggest we simply remove the line:

The document is now in AUTH48 so we can actually make this change.

Juergen, and/or Benoit, do you think we can make this change to the
document?  If we do, we should also mention this in section 1.1.

Eventually the type yang-identifier from RFC 6991 should be revised as
well.

/martin

> 
> If it is still possible, it would IMO make a good sense to remove that
> comment from the ABNF in 6020bis, and make this change in sec. 7.1.4:
> 
> OLD
>

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 17 Aug 2016 14:50:11 +0200

> On 17 Aug 2016, at 14:34, Martin Bjorklund <[email-masked]> wrote:
> 

I agree, good riddance.

Lada

---

From: "Jernej Tuljak" <[email-masked]>
Date: Wed, 17 Aug 2016 15:18:04 +0200

Is there a reason for no normative/informative reference to the XML specification within the document? XML 1.0 has several editions and there's also XML 1.1. The document is quite specific when it comes to XSD, XPATH, XSLT, and even XML-NAMES but not XML itself.

Jernej

> -----Original Message-----
> From: netmod [mailto:[email-masked]] On Behalf Of Ladislav
> Lhotka
> Sent: Wednesday, August 17, 2016 2:50 PM
> To: Martin Bjorklund <[email-masked]>
> Cc: [email-masked]
> Subject: Re: [netmod] YANG 1.1: XML naming restriction
> 
> 
> >>> On 01 Aug 2016, at 10:15, William Lupton <wlupton@broadband-
> forum.org>
> >>> wrote:
> >>>
> >>>> And since Yang data node names can appear as XML element names,
> Yang
> >>>> has

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 17 Aug 2016 16:47:45 +0200

> On 17 Aug 2016, at 15:18, Jernej Tuljak <[email-masked]> wrote:
> 

I tend to agree, and it should be XML 1.0 because the document refers to the XML 1.0 version of [XML-NAMES]. I believe this reference can be added even in the AUTH48 phase.

Lada