[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Brain Teaser: Element Author is of type xsd:string, what's an illegal value of Author?
- From: "Costello, Roger L." <costello@mitre.org>
- To: <xml-dev@lists.xml.org>
- Date: Fri, 9 Feb 2007 07:59:22 -0500
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></Author>
because hex 8 is not in the above list of hex values. But hex 9 is
allowed:
<Author>	</Author>
So, these are all illegal values of Author:
�       
 
        
        
...
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]