It might also be worth noting (see 
https://github.com/mbj4668/pyang/wiki/InstanceValidation) that "DSDL schemas 
can be used with generic off-the-shelf XML tools for both syntactic and 
semantic validation of XML instance documents”. This includes validating “must” 
statements and so on. William.

> On 29 Mar 2016, at 08:22, Martin Bjorklund <[email protected]> wrote:
> 
> "Bogaert, Bart (Nokia - BE)" <[email protected]> wrote:
>> Is there a reason why the ABNF for example the when and must statement has
>> been "restricted" to when-keyword sep string optsep 
>> 
>> As "string"  can't be tokenized no errors are generated by YANG compilers if
>> this string contains an error, e.g. referred leaf does not exit due to a
>> typo.  This problem only exposes itself at run-time.  I was wondering why
>> this string was not broken down into a number of specific parts that define
>> the when statement so that these kind of errors can be trapped early in the
>> development process?   I am rather new in this so I did not follow all
>> discussions that led to the definition of YANG and hence have no idea
>> whether this was discussed and what were the reasons not to do it this way.
> 
> The arguments to the "when" and "must" statements are XPath 1.0
> expressions.  The syntax of XPath 1.0 is not defined by YANG, but by
> the XPath 1.0 spec.  This is the reason that the YANG grammar isn't
> more specific.
> 
> YANG compilers differ in their ability to detect errors in these XPath
> expressions.  Some perform more checks than others (unfortunately,
> pyang is pretty bad in this regard... (patches are always welcome:)).
> 
> [For your particular example, referencing a leaf that doesn't exist is
> not an error per se; it is perfectly valid XPath.  But it probably
> warrants a warning by the compiler.]
> 
> /martin
> 
> _______________________________________________
> 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