Open GoogleCodeExporter opened 9 years ago
I am not sure this is a bug. 3.3.3 of the XML spec says:
If the attribute type is not CDATA, then the XML processor MUST further process the
normalized attribute value by discarding any leading and trailing space
All attributes for which no declaration has been read SHOULD be treated by
non-validating processor as if declared CDATA.
So all these attributes are CDATA, and thus no whitespace stripping should take
place.
(BTW, the yin parser relies on expat for the XML parsing)
/martin
Original comment by mbj4...@gmail.com
on 26 Jan 2012 at 6:43
It is really a tricky question. My reading is that the value is pyang is in
fact a validating parser and requires the attribute value to be a non-negative
integer rather that opaque character data (see the error message).
Of course, the text in the XML spec speaks in terms of a DTD, so you can always
argue that as long as there is no DTD the attribute values should not be
normalized. But then the text would be effectively useless because nobody cares
about DTDs these days.
The practical issue, at least from my point of view, is that pyang differs from
RELAX NG validators when validating e.g. <min-elements value=" 2"/> against the
RNG schema in schema/yin.rng. I tried xmllint, jing and nxml-mode validator and
all consider the value to be a valid nonNegativeInteger. However, validation
against an equivalent XSD schema gives an error. Oh well. :-(
Lada
Original comment by lada.lho...@gmail.com
on 27 Jan 2012 at 9:28
Apart from the tricky XML normalization issues, pyang could perhaps be more
liberal and allow leading and trailing whitespace in number in both YANG and
YIN syntax, so that e.g.
min-elements " 1";
would be OK.
Lada
Original comment by lada.lho...@gmail.com
on 8 Mar 2012 at 1:39
Original issue reported on code.google.com by
lada.lho...@gmail.com
on 26 Jan 2012 at 2:29