Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   MSXML says a string doesn't fit the pattern defined in the schema (http://www.velocityreviews.com/forums/t166520-msxml-says-a-string-doesnt-fit-the-pattern-defined-in-the-schema.html)

Ashton 01-29-2004 08:55 PM

MSXML says a string doesn't fit the pattern defined in the schema
 
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


All times are GMT. The time now is 04:27 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.