W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2000

RE: String Lists

From: Biron,Paul V <Paul.V.Biron@kp.org>
Date: Mon, 4 Dec 2000 08:25:14 -0800
Message-Id: <376E771642C1D2118DC300805FEAAF43014BA816@pars-exch-1.ca.kp.org>
To: "'Kollu, Kishore'" <kishore_kollu@mentorg.com>, "'www-xml-schema-comments'" <www-xml-schema-comments@w3.org>
> -----Original Message-----
> From:	Kollu, Kishore [SMTP:kishore_kollu@mentorg.com]
> Sent:	Friday, December 01, 2000 5:30 PM
> To:	'Biron,Paul V'
> Subject:	RE: String Lists
> 
> Thank You Paul.
> 
> My schema fragment is something of a mixed of the two cases you mentioned.
> It goes something like this:
> **************************************************************************
> **
> ******************************************************
> <?xml version="1.0" encoding="UTF-8"?>
> <schema targetNamespace="http://www.mentor.com/icx/NGraph"
> xmlns:NGraph="http://www.mentor.com/icx/NGraph"
> xmlns="http://www.w3.org/2000/10/XMLSchema"
> elementFormDefault="unqualified"
> attributeFormDefault="unqualified">
> 	<annotation>
> 		<documentation>
> 		NGraph Viewer Schema
> 		</documentation>
> 	</annotation>
> 	<element name="firstElement" type="NGraph:firstElemType"/>
> 	<complexType name="firstElemType" mixed="true">
> 		<sequence>
> 			<element name='MyList'>
> 				<simpleType>
> 					<restriction
> base="NGraph:MyListType">
> 						<length value='5'/>
> 					</restriction>
> 				</simpleType>
> 			</element>
> 			<element name="ListName" type="string"/>
> 		</sequence>
> 	</complexType>
> 	<simpleType name="MyListType">
> 		<list itemType='string'/>
> 	</simpleType>
> </schema>
> **************************************************************************
> **
> ******************************************************
> In your first case,  <restriction> cannot be used without using "base="
> attribute. So, do you think there is still something wrong with XML Spy
> implementaion...
> 
True, we do not give any examples in the spec of using restriction without
the base attrs, but, you can use restriction without the base attribute,
provided you give a simpleType definition as its direct child.  We should
probably add an example demonstrating this feature.  We crafted the syntax
to allow this specifically for cases like yours so that you don't have to
"pollute" your type symbol space with "MyListType".

Now, having seen your schema I would have to say that XMLSpy's behavior is
not correct.

<MyList>a b c d e</MyList> should validate just fine (the first item in the
list is "a", the second is "b", etc.).

Have you tried using XMLSpy to validate lists of other atomic types (such as
<element name='listOfDecimal'>
	<simpleType>
		<restriction>
			<simpleType>
				<list itemType='decimal'/>
			</simpleType>
			<length value='5'/>
		</restriction>
	</simpleType>
</element>

<listOfDecimal>123.123 039.3938 103.00289 1.23 93.947</listOfDecimal>

If XMLSpy validates the above correctly, then you know that it correctly
implements the length facet for some lists, but has a bug with lists of
string.

pvb
> -----Original Message-----
> From: Biron,Paul V [mailto:Paul.V.Biron@kp.org]
> Sent: Friday, December 01, 2000 2:20 PM
> To: 'Kollu, Kishore'; 'www-xml-schema-comments@w3.org'
> Subject: RE: String Lists
> 
> 
> > -----Original Message-----
> > From:	Kollu, Kishore [SMTP:kishore_kollu@mentorg.com]
> > Sent:	Friday, December 01, 2000 2:01 PM
> > To:	'www-xml-schema-comments@w3.org'
> > Subject:	String Lists
> > 
> > Hi,
> >  I am trying to use list of strings in schema. I set the value of facet
> > length to 5.
> > 
> > In the instance document if I have a list 
> > <MyList>a b c d e</MyList>, the IDE (XML Spy 3.5 beta 2) complains
> > that the value does not match the facet length = 5.
> > But if the same list is <MyList>abcde</MyList> then it does not
> complain.
> > 
> First, I have to ask, what does your schema fragment look like?  In other
> words, it all hinges on HOW you've defined "a list of strings with length
> facet = 5".  You may not have defined the type you thought you did.
> 
> Is your schema fragment something like the following:
> 
> <element name='MyList'>
> 	<simpleType>
> 		<restriction>
> 			<simpleType>
> 				<list itemType='string'/>
> 			</simpleType>
> 			<length value='5'/>
> 		</restriction>
> 	</simpleType>
> </element>
> 
> If so, then the instance fragment:
> 
> 	<MyList>a b c d e</MyList>
> 
> should validate properly and
> 
> 	<MyList>abcde</MyList>
> 
> is schema invalid, and hence, the error would appear to be in XML Spy's
> implementation.
> 
> If however, your schema fragment looks something like:
> 
> <element name='MyList'>
> 	<simpleType>
> 		<restriction base='string'>
> 			<length value='5'/>
> 		</restriction>
> 	</simpleType>
> </element>
> 
> then <MyList>a b c d e</MyList> should be invalid, but
> <MyList>abcde</MyList> should validate just fine and XML Spy's behavior
> would be correct.
> 
> If your schema fragment looks different than either of the above I'd like
> to
> know..
> 
> pvb
Received on Monday, 4 December 2000 11:48:22 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT