Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > MSXML schema validation on type "token"

Reply
Thread Tools

MSXML schema validation on type "token"

 
 
linkspeed
Guest
Posts: n/a
 
      10-29-2003
Hi, I tried following element definition in MSXML 4.0
<xsd:element name="Identifier">
<xsd:simpleType>
<xsd:restriction base="xsd:token">
<xsdattern value=".*"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

It can validate XML text like: <Identifier>abbbb</Identifier>
But not :
<Identifier>
abbbb</Identifier>

and
<Identifier>abbbb
</Identifier>

and
<Identifier>
abbbb
</Identifier>

Isn't token a white space collapsed string?

Cheers
Linkspeed
 
Reply With Quote
 
 
 
 
Martin Boehm
Guest
Posts: n/a
 
      10-31-2003
"linkspeed" <> wrote in message
news: om

> Hi, I tried following element definition in MSXML 4.0
> <xsd:element name="Identifier">
> <xsd:simpleType>
> <xsd:restriction base="xsd:token">
> <xsdattern value=".*"/>
> </xsd:restriction>
> </xsd:simpleType>
> </xsd:element>


What sense does this kind of pattern have?

> It can validate XML text like: <Identifier>abbbb</Identifier>
> But not :
> <Identifier>
> abbbb</Identifier>


Sure, not at last because your pattern does not allow newlines. A token
cannot contain newlines, either.

> Isn't token a white space collapsed string?


It maybe *has to be* a string containing no white spaces, but it is not
converted to one as the schema is used for validation. The schema must
match the XML *as is*, not as *would be*. If you used base="xsd:string"
as restiction base it also would not have worked out (because of the
pattern).

Martin


 
Reply With Quote
 
 
 
 
Richard Tobin
Guest
Posts: n/a
 
      10-31-2003
In article <3fa2993f$0$14720$>,
Martin Boehm <> wrote:

>Sure, not at last because your pattern does not allow newlines. A token
>cannot contain newlines, either.


But the token type has a whiteSpace facet with value "collapse", so
the newline should be turned into a space and then removed *before*
testing for validity.

-- Richard
--
Spam filter: to mail me from a .com/.net site, put my surname in the headers.

FreeBSD rules!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MSXML and Schema: Using for XML-Node creation Udo XML 0 08-12-2006 09:12 PM
Problem with schema-validation and property "http://apache.org/xml/properties/schema/external-schemaLocation" Markus Java 1 11-23-2005 02:41 PM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
xml validation using msxml and schema cyberleo80@libero.it XML 2 01-04-2005 09:38 AM
MSXML says a string doesn't fit the pattern defined in the schema Ashton XML 0 01-29-2004 08:55 PM



Advertisments