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

[XML Schema 1.1] I need an example that illustrates the usefulness of xs:error

From: Costello, Roger L. <costello@mitre.org>
Date: Tue, 21 Jul 2009 15:56:59 -0400
To: "xmlschema-dev@w3.org" <xmlschema-dev@w3.org>
Message-ID: <9E51F88D5247B648908850C35A3BBB5004009EEE20@IMCMBX3.MITRE.ORG>
[XML Schema 1.1] I need an example that illustrates the usefulness  of xs:error

Hi Folks,

Consider this usage of xs:error:

<xs:element name="Publication" type="PublicationType">
     <xs:alternative test="@kind eq 'magazine'" type="MagazineType" />
     <xs:alternative test="@kind eq 'book'" type="BookType" />
     <xs:alternative test="(@kind ne 'book') and (@kind ne 'magazine')" 
                     type="xs:error" />
</xs:element>

It says that if an instance document has a Publication element with a kind attribute not equal to 'book' or 'magazine' then throw an error.

But that doesn't illustrate the usefulness of xs:error because the same functionality can be accomplished by simply constraining @kind:

<attribute name="kind">
    <simpleType>
        <restriction base="string">
            <enumeration value="book" />
            <enumeration value="magazine" />
        </restriction>
    </simpleType>
</attribute>

Can you provide an example that illustrates the usefulness of xs:error?

/Roger
Received on Tuesday, 21 July 2009 19:57:35 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
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-2007 All Rights Reserved.