Classroom critique of XML Schema 1.1

Hi Folks,

This week I taught a 3-day intensive on XML Schema 1.1 to a group of top-notch software, security, and information engineers. The consensus of the class was that XML Schema 1.1 has problems that should be fixed before it goes to Recommendation status.


1. XML Schema 1.1 has a restriction that the XPath expression in an <assert> element can only "look down." It cannot reference items higher up in the XML tree, nor can it reference items in other XML documents. However, an attribute that is declared higher up in the XML tree can be referenced by the <assert> element if it is declared inheritable (inheritable="true"). During discussions it became apparent that inheritable attributes were created as an end-run around the restriction that the XPath expression in <assert> elements can't "look up." 

Recommendation: Lift the restriction that the XPath expression in <assert> elements can only "look down." Permit the XPath expression to look anywhere, including to other XML documents. 


2. The attributes identified by defaultAttributes only applies to that schema file, not to imported or included schema files. That rule seems reasonable for imported schema files but not for included schema files. A schema file and its included schema files are really all part of the same schema.

Recommendation: Add an attribute on <include> that indicates that the included schema file has the attributes identified by defaultAttributes in the including schema file:

<include schemaLocation="..."
         defaultAttributes="..." />


3. If an element has multiple inheritable attributes in its ancestors and they have the same name, only the closest one will be visible to the element. For example, suppose the <Comment> element has two xml:lang attributes (both inheritable) that are ancestors:

<Document xml:lang="FR">
    <Chapter>
        <Section xml:lang="EN">
            <Comment>

An XPath expression in an <assert> element on <Comment> can only use the closest xml:lang attribute (xml:lang="EN"). It cannot use the xml:lang attribute that is higher up (xml:lang="FR").


Recommendation: Allow XPath expressions in <assert> and <alternative> elements to use any inheritable attribute in its ancestors.

/Roger 

Received on Friday, 18 March 2011 19:11:07 UTC