MSXML says a string doesn't fit the pattern defined in the schema

Discussion in 'XML' started by Ashton, Jan 29, 2004.

  1. Ashton

    Ashton Guest

    Hello,
    I am fairly new to all this XML stuff. I have recently taken over
    some coding on a project that involves reading in xml documents and
    validating them based on some schema files. The schema files were
    written long before I started working on the program, so I had no
    input in their creation. We created a tool that uses MSXML to load
    and validate the documents. 99% of it works great. The last 1% is
    stumping me. There are a couple of elements that we want to hold some
    plain text. The .xsd and .xml documents were edited in XMLSpy and
    validate just fine. When I use my tool, however, it says that the
    Pattern constraint failed, and the element has an invalid value
    according to it's data type. The schema contains
    ....
    <!-- =========== -->
    <xs:simpleType name="TextSubjectString">
    <xs:annotation>
    <xs:documentation>String data.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="UsAsciiPrintableString">
    <xs:minLength value="1"/>
    <xs:maxLength value="20"/>
    </xs:restriction>
    </xs:simpleType>

    <!-- =========== -->
    <xs:simpleType name="UsAsciiPrintableString">
    <xs:annotation>
    <xs:documentation>Unformatted text.</xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
    <xs:pattern value="[\p{IsBasicLatin}-[\p{C}]]*"/>
    </xs:restriction>
    </xs:simpleType>
    <!-- =========== -->

    In XMLSpy, pretty much any string of the appropriate length works
    fine. In my tool (and another tool that uses MSXML4) it will only
    validate successfully if the value is a single character.
    Since I haven't worked with XML very long, I don't know if the pattern
    in the schema is right. It just seems strange to me that XMLSpy is
    okay with it, but MSXML fails.

    Thanks for any input.
    Ashton
    Ashton, Jan 29, 2004
    #1
    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. linkspeed
    Replies:
    2
    Views:
    699
    Richard Tobin
    Oct 31, 2003
  2. Replies:
    2
    Views:
    4,364
  3. Piet
    Replies:
    0
    Views:
    510
  4. Udo
    Replies:
    0
    Views:
    356
  5. Oodini
    Replies:
    1
    Views:
    1,754
    Keith Thompson
    Sep 27, 2005
Loading...

Share This Page