Classroom critique of XML Schema 1.1

"Costello, Roger L." <[email protected]>
Newsgroups gmane.text.xml.schema.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.