OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   RE: [xml-dev] Subtyping in XML

[ Lists Home | Date Index | Thread Index ]

I'm sure this is an old chestnut, but as long as we're on the topic of
expanded value spaces for restricted types:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>
   <xs:element name="root">
            <xs:element name="foo" type="testString" maxOccurs="4"/>

   <xs:simpleType name="testString">
      <xs:restriction base="xs:string">
         <xs:pattern value="This is a test"/>

   <xs:simpleType name="testStringR">
      <xs:restriction base="testString">
         <xs:whiteSpace value="collapse"/>

The type testStringR is actually less restrictive than it's base in terms of
the values it accepts:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

	<foo>This is a test</foo>
	<foo xsi:type="testStringR">This is a test</foo>

	<foo xsi:type="testStringR">This       is a test</foo>  <!--
restricted type accepts -->
	<foo>This       is a test</foo>
<!-- base type fails -->


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS