[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"?
**************************************************************** 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 "&" 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. &. 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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|