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

RE: Will "AT&T" fit in a string attribute with maxLength="4"?


xs string length
> What is the behavior of other tools?
> 
> Alessandro Triglia

I have reran it through the MSXML 4.0, and it does not exhibit this
behavior: 
"&&&&" counts as 4 chartacters. 

>> Any way to make the parser decode the entity before checking
>> the string length?

>They are supposed to do that.

>Julian

It seems to be the case of XMLSpy bug...

Thanks 

-Marek

> > -----Original Message-----
> > From: Zielinski, Marek [mailto:mzielinski@g...] 
> > Sent: Tuesday, May 20, 2003 13:47
> > To: 'Xml-Dev (E-mail)
> > Subject:  Will "AT&T" fit in a string attribute with 
> > maxLength="4"?
> > 
> > 
> > I am trying to define restrictions on string lengths using 
> > Schema. The data actually comes from databases, and is 
> > exchanged between two different systems. I encountered a 
> > snag: when the string contains one of the reserved 
> > characters, like "&", the parser automatically translates it 
> > into an entity, e.g. &. This increases the length of the 
> > string, and now the string does not fit; the validator (I am 
> > using XMLSpy) rejects it as too long.  
> 
> 
> How can  &  count as 5 characters, given that it is present in the
> infoset as a single ISO/IEC 10646 character?  Would  &  count as 5
> characters too??  I hope not.
> 
> What does XML Spy check facets against, the XML 1.0 serialization, or
> the infoset?
> 
> What is the behavior of other tools?
> 
> Alessandro Triglia
> 
> 
> > 
> > I could add a couple of characters to the maxLength 
> > restriction, but this defeats the purpose of length limit. 
> > Besides, to be safe I would need to make the limit about 4 
> > times larger than the intended limitation on the actual 
> > string length. (i.e. if want to limit string to 4 chars, and 
> > the string happens to be "&&&&")
> > 
> > Any solution? Any way to make the parser decode the entity 
> > before checking the string length? 
> > 
> > -Marek Zielinski
> > GMA
> > 
> > Example below: the XML does not validate, although the string 
> > is originally 'AT&T'.
> > 
> > Sample XML:
> > <PhoneCompany Name="AT&amp;T"/>
> > 
> > Sample Schema:
> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > elementFormDefault="qualified" attributeFormDefault="unqualified">
> > 	<xs:element name="PhoneCompany">
> > 		<xs:complexType>
> > 			<xs:attribute name="Name" use="optional">
> > 				<xs:simpleType>
> > 					<xs:restriction 
> > base="xs:string">
> > 						<xs:maxLength 
> > value="4"/>
> > 					</xs:restriction>
> > 				</xs:simpleType>
> > 			</xs:attribute>
> > 		</xs:complexType>
> > 	</xs:element>
> > </xs:schema>
> > 
> > -----------------------------------------------------------------
> > The xml-dev list is sponsored by XML.org 
> > <http://www.xml.org>, an initiative of OASIS 
> <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
> 
> 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.