Hence why we go through so many hoops in the line-wrapping draft.

Adrian

> -----Original Message-----
> From: netmod [mailto:[email protected]] On Behalf Of Martin Bjorklund
> Sent: 09 October 2018 11:07
> To: [email protected]
> Cc: [email protected]
> Subject: Re: [netmod] Whitespace in XML encoding - allowed ?
> 
> Balázs Lengyel <[email protected]> wrote:
> > 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>
> >
> > 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.
> 
> For example, RFC 7950 says about integers in 9.2.1:
> 
>    An integer value is lexically represented as an optional sign ("+" or
>    "-"), followed by a sequence of decimal digits.  If no sign is
>    specified, "+" is assumed.
> 
> So, space characters (and other characters) are not allowed.  In XML,
> whitespace has meaning, so:
> 
>    <foo>42</foo>
> 
> is not the same as
> 
>    <foo> 42 </foo>
> 
> Since the string " 42 " is not a legal integer lexical representation
> according to 9.2.1, <foo> 42 </foo> is not a valid XML representation
> for the integer foo.
> 
> > 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>
> 
> Yes, to be strict, these examples should have had some text that
> explained that whitespace was added for readability.  New documents
> will hopefully use the new artwork draft's rules instead.
> 
> 
> 
> /martin
> 
> 
> > 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: [email protected]
> 
> _______________________________________________
> netmod mailing list
> [email protected]
> https://www.ietf.org/mailman/listinfo/netmod

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to