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

Brain Teaser: Element Author is of type xsd:string, what's an illegal va

  • From: "Costello, Roger L." <costello@m...>
  • To: <xml-dev@l...>
  • Date: Fri, 9 Feb 2007 07:59:22 -0500

Brain Teaser: Element Author is of type xsd:string
Hi Folks,

[This may be obvious to you.  It wasn't to me, so I thought that I'd
share my insight.]

Suppose I declare an Author element to be of type string:

<xsd:element name="Author" type="xsd:string" />

Then I create an XML instance document:

<?xml version="1.0"?>
<Book>
        <Author>...</Author>
</Book>

Question: what is an invalid (non-string) value for <Author>?

If the Author contains "<" or "@"

       <Author> if A < B then </Author>

then it is not well-formed.  However, that's not the same thing as
giving Author a non-string value.

So what's the answer?  Doesn't "string" mean that Author can contain
anything, and there are no illegal values for Author?

Scroll down to see the answer.....

































These are the characters that comprise the string datatype (these are
the hex values of the characters):

#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

Thus, an illegal value of Author is any character that falls outside
this set of characters.  For example, this is illegal:

       <Author>&#x8;</Author>

because hex 8 is not in the above list of hex values.  But hex 9 is
allowed:

       <Author>&#x9;</Author>

So, these are all illegal values of Author:

&#x0;  &#x1;   &#x2;  &#x3;    &#x4;    &#x5;    &#x6;     &#x7;
&#x8;    &#xB;  
&#xC;  &#xE;  &#xF;  &#x11;  &#x12;  &#x13;  &#x14;   &#x15;  &#x16;
&#x17;  &#x18;  &#x19;  &#x1A;   &#x1B;  &#x1C;  &#x1D;  &#x1E;  &#x1F;
...


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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.