An RNG and XML Namespace Puzzle

MURATA Makoto eb2m-mrt at asahi-net.or.jp
Mon Aug 22 03:43:49 CEST 2011


If an attribute pattern does not explicitly specify the ns attribute,
any attribute
matching has to be unprefixed.

Regards,
Makoto

2011/8/22 Dennis E. Hamilton <dennis.hamilton at acm.org>:
> 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?
>
>  - Dennis
>
> -----Original Message-----
> 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
>
> Dennis,
>
> 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.
>
> http://relaxng.org/tutorial-20011203.html#IDAIGZR
>
> 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
>>
>> DETAILS
>>
>> The variability in my analysis is evident in the table on this page:
>>
>> <http://tools.oasis-open.org/version-control/svn/oic/TestSuite/trunk/odf12/NameSpaceResilience/NameSpaceResilience-Results.htm>
>>
>> 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
>>
>> <http://tools.oasis-open.org/version-control/svn/oic/TestSuite/trunk/odf12/NameSpaceResilience/>.
>>
>> The file NamSpaceResilience.txt summarizes what they are and what is expected with each one.
>>
>>
>
>
>
> --
>
> Praying for the victims of the Japan Tohoku earthquake
>
> Makoto
>
>



-- 

Praying for the victims of the Japan Tohoku earthquake

Makoto


More information about the sc34wg1study mailing list