[Bug 7242] New: Type inconsistencies introduced by inheritable attributes

http://www.w3.org/Bugs/Public/show_bug.cgi?id=7242

           Summary: Type inconsistencies introduced by inheritable
                    attributes
           Product: XML Schema
           Version: 1.1 only
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Structures: XSD Part 1
        AssignedTo: David_E3@VERIFONE.com
        ReportedBy: Peter.Geraghty@tracegroup.com
         QAContact: www-xml-schema-comments@w3.org
                CC: cmsmcq@blackmesatech.com


Inheritable attributes as specified allow schemas to be produced which weaken
typed information checking and processing.  By this I mean that for someone
formulating a processing rule (e.g., XPath expression), or producing a binding
for a particular complex type, the possibility of inheritable attributes is a
difficulty when it comes to creating a definition which can be known to be
valid prior to receipt of any particular instance message.

If I understand it correctly, the type and the existence of an inherited
attribute are dependent on the ancestor in the instance document within which
an element of a particular type appears, not on the type of the element itself.
 Most of the examples I have seen are considering xml:lang etc. and assume that
there is a single governing attribute definition which will apply to all
inheritors in any context, but I see nowhere that states this is required to be
the case.

For example, an element of a particular type could inherit an attribute called
“required” which in one situation referred to a boolean saying whether or not
something was required, but in another situation an element of the same type
could inherit an attribute also called "required" which was a date by which
something was required.  This is true even if the type itself specified a third
attribute also called "required" which was of type integer.

The semantics of an inherited attribute may also be misleading if applied to
all descendant elements willy nilly, even if there is no type difference.  For
example, an attribute called “version” could in one context refer to the
version of the software which produced a document but in another context could
refer to the version of the document which was produced.

A document which had passed validation and was then processed using XPath based
on an XDM which in turn was based on the PSVI could produce unexpected and
problematic results in these situations. 

The problems above could be avoided if inheritability was limited to attributes
which are declared at top-level.

There is also a different semantic problem, which is in the applicability of
inheritable attributes to descendant elements.

I have seen an example along the following lines…. Suppose start-time is
declared as inheritable….

<Conference start-time="08:00:00">
     <Meeting>
         <Beverage>Juice</Beverage>
    </Meeting>
</Conference>

Here start-time may have meaning for Meeting but presumably not for Beverage. 
If I am producing a Java binding for Beverage, or providing GUI tooling to
guide a user through a rule relating to Beverage, how do I know whether
start-time is relevant or irrelevant?  Shouldn't the schema author be able to
specify this?

A possible solution to this is to say that inheritable attributes should be
applied only to descendants whose type definitions include compatible attribute
uses or attribute wildcards.  The defaultAttributeGroup enhancement makes it
easy for such attribute uses to be applied across the board if that is what the
schema author intends.

In summary, the intention to support xml:lang etc. could be supported in a more
controlled and appropriate way if
(a)     Only top-level attributes are inheritable and 
(b)     Inheritance only happens if the inheriting element’s type would produce
a corresponding attribute attribution were the attribute to appear explicitly.

On a more specific point section 3.12 specifies that the XDM be constructed to
include Inheritable attributes.  Section 3.13 does not specify this but I think
that from what has been said elsewhere there is an implication that when an XDM
is constructed from a PSVI inheritable attributes be included.  However the
referenced edition of XDM is the current recommendation which obviously does
not specify this.  Perhaps this needs to be said.


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Friday, 7 August 2009 16:51:15 UTC