Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - >Thread Next - Re: [XML Schema 1.1] I need an example that illustrates the [XML Schema 1.1] I need an example that illustrates the usefulnessTo: "xmlschema-dev@--.---" <-------------@--.---> Date: 7/21/2009 7:59:00 PM
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
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
