[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Derivation by restriction in XML Schema

  • From: "Arnold, Curt" <Curt.Arnold@h...>
  • To: "'www-xml-schema-comments@w...'" <www-xml-schema-comments@w...>
  • Date: Mon, 6 Mar 2000 12:24:17 -0700

xml schema minoccur
The current formulation of derivation by restriction
appears to have a couple of shortcomings:

It is not possible to derive a complex type that
is both a restriction and extension of a base type
without using two separate derivation.

It does not appear possible to restrict the value
of an attribute from another namespace that
was introduced using a <attributeGroup ref="other:attgroup"/>
For example, if would not be possible to restrict
xml:lang to a list of supported languages or one of the
xlink attributes to a subset of supported values.

By performing restriction using the same elements
and data model as declaration there are ample
opportunities for inconsistency between the
initial declaration and the restriction.  For 
instance, the restriction of a datatype may
imply a different base type than the initial
definition or a restriction of the content
may introduce content that is inconsistent
with the initial content model.

The method of addressing fragments of element content
of a type for restriction is poorly defined and
complicated.

The capabilities mentioned in the primer of renaming
elements and attributes seem way over-the-top.
However, you could still use the approach described
below by adding adding a distinct attribute for the
new name to the restriction element and attribute
elements.

It appears that these problems may be eliminated by
allowing <complexType> have a <restrict> child element
and defining restrict-scoped <element>, <attribute>,
et al that only allow restrict-appropriate attributes and 
content and removing the derivedBy attribute.  The attribute
element's name attribute is a QName that allows you to 
reference attributes introduced by attribute group
reference, it would not attempt to restrict attributes
encountered that were allowed only through a <anyAttribute>
element.  The match attribute on <element> et al is an 
subset XPath that operates on an InfoSet that is the 
base type's expanded content model (all group ref's and
ancestor content brought in line).


The following is my attempt to write this in the current
schema for schemas.

<element name="restrict">
    <complexType base="annotated">
	<choice minOccur="0" maxOccur="*">
        	<element name="element">
	    		<complexType base="annotated">
				<element ref="facet" minOccur="0" maxOccur="*"/>
				<attribute name="match" type="XPathApprox" minOccur="1"/>
				<attributeGroup ref="occurs"/>
				<attributeGroup ref="valueConstraint"/>
	    		</complexType>
		</element>
        	<element name="choice">
	    		<complexType base="annotated">
				<attribute name="match" type="XPathApprox" minOccur="1"/>
				<attributeGroup ref="occurs"/>
	    		</complexType>
		</element>
        	<element name="sequence">
	    		<complexType base="annotated">
				<attribute name="match" type="XPathApprox" minOccur="1"/>
				<attributeGroup ref="occurs"/>
	    		</complexType>
		</element>
        	<element name="all">
	    		<complexType base="annotated">
				<attribute name="match" type="XPathApprox" minOccur="1"/>
				<attributeGroup ref="occurs"/>
	    		</complexType>
		</element>
        	<element name="any">
	    		<complexType base="annotated">
				<attribute name="match" type="XPathApprox" minOccur="1"/>
				<attributeGroup ref="occurs"/>
	    		</complexType>
		</element>
	</choice>
        <element name="attribute" minOccur="0" maxOccur="*">
	    <complexType base="annotated">
		<!--  you can have any number of additional facets
                         that constrain this restriction   -->
		<element ref="facet" minOccur="0" maxOccur="*"/>
		<!--   QName so that you can refer to other namespaces -->
		<attribute name="name" type="QName" minOccur="1"/>
		<attributeGroup ref="occurs"/>
		<attributeGroup ref="valueConstraint"/>
	     </complexType>
	</element>
	<!--  in this context it prohibits the attributes in the listed namespaces  -->
	<element name="anyAttribute" minOccur="0">
		<complexType>
			<attribute name="namespace" type="namespaceList"/>
		</complexType>
	</element>
    </complexType>
</element>



***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.