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

A

Ashton

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top