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] XML Schema to relaxNG xslt

[ Lists Home | Date Index | Thread Index ]

> Kawaguchi-san wrote an 
> interesting article about this a couple of months ago [1] 
> where he gives 
> another example of a derivation by restriction that look 
> correct but isn't.
> 
> Cheers,
> /Eddie
> 
> [1] http://www.xml.com/pub/a/2001/06/06/schemasimple.html?page=1

I think intuition would expect (incorrectly) the following to be a valid
restriction:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:qux="http://www.example.com/foobar";
targetNamespace="http://www.example.com/foobar";
elementFormDefault="qualified" attributeFormDefault="unqualified">
	
	<xs:simpleType name="name_t">
		<xs:restriction base="xs:string">
			<xs:pattern value="[A-Z][a-z]*"/>
		</xs:restriction>
	</xs:simpleType>
	
	<xs:complexType name="foo">
		<xs:sequence>
			<xs:element name="firstName" type="qux:name_t"/>

			<xs:element name="lastName" nillable="false">
				<xs:simpleType>
					<xs:restriction base="xs:string">
						<xs:pattern
value="[A-Z][a-z]*"/>
					</xs:restriction>
				</xs:simpleType>
			</xs:element>

		</xs:sequence>
	</xs:complexType>
	
	<xs:complexType name="bar">
		<xs:complexContent>
			<xs:restriction base="qux:foo">
				<xs:sequence>
					<xs:element name="firstName">
						<xs:simpleType>
							<xs:restriction
base="qux:name_t">
								<xs:pattern
value="L[a-z]*"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:element>

					<xs:element name="lastName"
nillable="false">
						<xs:simpleType>
							<xs:restriction
base="xs:string">
								<xs:pattern
value="[A-Z][a-z]*"/>
							</xs:restriction>
						</xs:simpleType>
					</xs:element>

				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>
	</xs:complexType>
</xs:schema>






 

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

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