MSXML schema validation on type "token"

Discussion in 'XML' started by linkspeed, Oct 29, 2003.

  1. linkspeed

    linkspeed Guest

    Hi, I tried following element definition in MSXML 4.0
    <xsd:element name="Identifier">
    <xsd:simpleType>
    <xsd:restriction base="xsd:token">
    <xsd:pattern 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
     
    linkspeed, Oct 29, 2003
    #1
    1. Advertising

  2. linkspeed

    Martin Boehm Guest

    "linkspeed" <> wrote in message
    news:

    > Hi, I tried following element definition in MSXML 4.0
    > <xsd:element name="Identifier">
    > <xsd:simpleType>
    > <xsd:restriction base="xsd:token">
    > <xsd:pattern 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
     
    Martin Boehm, Oct 31, 2003
    #2
    1. Advertising

  3. In article <3fa2993f$0$14720$-online.net>,
    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!
     
    Richard Tobin, Oct 31, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Markus
    Replies:
    1
    Views:
    1,557
    Markus
    Nov 23, 2005
  2. Replies:
    2
    Views:
    4,385
  3. Cronus
    Replies:
    1
    Views:
    677
    Paul Mensonides
    Jul 15, 2004
  4. G Fernandes
    Replies:
    1
    Views:
    531
  5. Wessi
    Replies:
    3
    Views:
    864
    Lawrence Kirby
    Aug 11, 2005
Loading...

Share This Page