qiuwei / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
1 stars 1 forks source link

Better Jing validation error message for namespaced attributes for specific cases #151

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When a RNG schema specifies an attribute that must be in a certain namespace 
and an instance document is validated against it in which the attribute is 
properly named but is not prefixed (at all) the validator will output a rather 
cryptic message such as this one (the instance has a corresponding namespace 
defined in the root element and the attribute must appear in one of the child 
elements):

'attribute "attr-name" not allowed here; expected attribute "attr-name"'

which is inconsistent with the message which would be displayed for a 
practically analogous case when this happens for XML elements. There a detailed 
explanation is displayed saying something like "I expected an element from this 
and that namespace".
I realize that there is no ordering of attributes and that different rules 
apply with namespaces for elements and attributes so the same message may not 
apply but at least a hint could be provided as to what went wrong when an 
attribute has a proper local-name but is not from a proper namespace.

I'm sure this could easily be improved in some manner and would help avoid 
having confused users around.

Note: attributes do not inherit namespaces - there is no default attribute 
namespace. The only way a for an attribute to be in a namespace is for it to be 
prefixed and as such bound to a namespace 
(http://www.xmlplease.com/attributexmlns). So this may even be treated as a bug 
since one could assume that you expect default namespaces for unprefixed 
attributes (the message certainly suggests so).

Original issue reported on code.google.com by jernej.t...@gmail.com on 22 Mar 2012 at 10:50

GoogleCodeExporter commented 8 years ago
This applies to jing-20091111.

Original comment by jernej.t...@gmail.com on 22 Mar 2012 at 10:58