[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"?

  • To: "'Xml-Dev (E-mail)" <xml-dev@l...>
  • Subject: RE: Will "AT&T" fit in a string attribute with maxLength="4"?
  • From: "Foster, Warwick" <Warwick.Foster@a...>
  • Date: Wed, 21 May 2003 13:57:31 +1000
  • Return-receipt-to: "Foster, Warwick" <Warwick.Foster@a...>

xml maxlength
****************************************************************
                            IMPORTANT

 The information transmitted is for the use of the intended recipient only and may contain confidential and/or legally privileged material. Any review, re-transmission, disclosure dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited and may result in severe penalties.  If you have received this e-mail in error please notify the Privacy Hotline of the Australian Taxation Office, telephone 13 28 69 and delete all copies of this transmission together with any attachments. 
****************************************************************

Is it possible for XMLSpy or the instence of the XML Schema 
to not be setup correctly?

If the validating schema does not contain a resolution for 
the entity then maybe it is defaulting back to examining the 
"&amp;" as a string and not an entity reference. If that is 
the case then the error in XMLSpy is not in measuring the 
string incorrectly but not trapping an entity resolution error.


Warwick Foster
Australian Tax Office

-----Original Message-----
From: Thomas B. Passin [mailto:tpassin@c...] 
Sent: Wednesday, 21 May 2003 05:22
To: 'Xml-Dev (E-mail)
Subject: Re:  Will "AT&T" fit in a string attribute with
maxLength="4"?


[Zielinski, Marek]

> 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. &amp;. 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.
>

XML input can never actually contain the literal character "&" (unless it is
in CDATA, of course).  It must be written as & a m p ; (less the spaces).
Even if it were held in the database as a single ampersand character, when
serialized to xml it would have to be escaped.  Once parsed, the string
passed to the application should contain the original "&" character.

So the real question is,  does the length restriction in xml schema apply to
the raw xml or the the string stored in the infoset after parsing?

Section 2.2 of Part 1 of the Schema Rec says

"  The concepts and definitions used herein regarding XML are framed at the
abstract level of information items as defined in [XML-Infoset]. By
definition, this use of the infoset provides a priori guarantees of
well-formedness (as defined in [XML 1.0 (Second Edition)]) and namespace
conformance (as defined in [XML-Namespaces]) for all candidates for
*assessment* and for all *schema documents*. "

So clearly xml schema assessment has to take place after all the entities
and character references have been replaced by the parser.

So this looks like a bug in Spy.

Cheers,

Tom P



-----------------------------------------------------------------
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.