An RNG and XML Namespace Puzzle
Dennis E. Hamilton
dennis.hamilton at acm.org
Mon Aug 22 03:06:07 CEST 2011
Thank you, that is very helpful.
My only remaining question: What if an attribute *is* only defined with an ns prefix in the RNG. Can an instance be unprefixed in any instance of an element where it is allowed?
From: eb2mmrt at gmail.com [mailto:eb2mmrt at gmail.com] On Behalf Of MURATA Makoto
Sent: Sunday, August 21, 2011 16:54
To: dennis.hamilton at acm.org
Cc: SC34 WG1 Zip Study Group; Alex Brown; MURATA Makoto (FAMILY Given)
Subject: Re: An RNG and XML Namespace Puzzle
I do not understand your question very well, but let me try
to explain two things separately.
1) XML namespaces
A prefixed element or attribute belongs to the namespace bound
to that prefix.
An unprefixed element belongs to the default namespace specified
by the xmlns="..." dcl (the default namespace).
An unprefixed attribute does not belong to a namespace.
2) RELAX NG
The ns attribute specifies namespaces and it controls both
attribute and element patterns. However, attribute patterns
and element patterns behave differently when they do not
have the ns attribute. In the case of element patterns,
the ns attribute is borrowed from ancestor patterns. Meanwhile,
in the case of attribute patterns, the ns attribute is assumed
to be "" and attributes matching the attribute patterns
do not belong to namespaces.
2011/8/22 Dennis E. Hamilton <dennis.hamilton at acm.org>:
> I have a puzzle concerning the use of Namespace binding on attributes when the RNG schema specifies them.
> My assumption is that however the namespace is bound on the element having the attributes (i.e., by a default namespace declaration), the attributes still require explicit prefixes that are bound to the appropriate namespace.
> Put another way, I assume that there are no conditions where those attributes can occur without a bound prefix and, in particular, there is no understood use of the unprefixed-attributes as attributes of the element absent any declaration to that effect.
> I figure this list will be seen by enough who understand the RNG and XML and XML Namespace rules to find an answer.
> The reason I'm asking is the existence of test documents that include variations on this case. In some cases, ODF consumers accept the unprefixed attribute names without ceremony. I can't tell if that is correct because I have observed some of those consumers accepting what are clearly incorrect XML documents. I am not so concerned that some consumers accept unprefixed attribute names. I just want to know if that is within the letter of RNG validity.
> - Dennis
> The variability in my analysis is evident in the table on this page:
> The folder with all of the test documents, the XML files that shows the cases, and a summary description of the set of test cases is at
> The file NamSpaceResilience.txt summarizes what they are and what is expected with each one.
Praying for the victims of the Japan Tohoku earthquake
More information about the sc34wg1study