DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17020>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17020 value space check on a pattern restricted dateTime seems incorrect Summary: value space check on a pattern restricted dateTime seems incorrect Product: Xerces2-J Version: 2.3.0 Platform: PC OS/Version: Windows NT/2K Status: NEW Severity: Normal Priority: Other Component: XML Schema datatypes AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I wanted to restrict the first 4 digits (YYYY) of date types to be in the range 1000 - 9999. I tried the following pattern restriction on xsd:date, xsd:dateTime, xsd:gYear, and xsd:gMonthDay: <xsd:pattern value="[1-9][0-9]{3}.*" /> The .* should allow the lexical space to be anything after the YYYY, but the value space checks should prevent crazy, non-date data. Right? However, when I apply this pattern restriction on the xsd:dateTime type, I have an instance value of '2003-02-12T15:01:01x' (note the 'x'), and I get no parse error. If I tack on the 'x' on instance values against similarly restricted types xsd:date, xsd:gYear, and xsd:gMonthDay, the value space checks report an error, as expected. For example, if I have '2003-02-12x' as a value for an xsd:date element, which is defined with the exact same pattern restriction, I get a parse error, thankfully. Is there an inconsistency here? Here's my schema: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="test_namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="test_namespace" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="Test"> <xsd:complexType> <xsd:sequence> <!-- Just restrict the YYYY (range 1000 to 9999) --> <xsd:element name="dateTime" minOccurs="0"> <xsd:simpleType> <xsd:restriction base="xsd:dateTime"> <xsd:pattern value="[1- 9][0-9]{3}.*" /> </xsd:restriction> </xsd:simpleType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> Here's my instance which when validated doesn't report an error: <?xml version="1.0" encoding="UTF-8"?> <Test xmlns="test_namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema- instance" xsi:schemaLocation="test_namespace test_schema.xsd"> <dateTime>2003-02-12T15:01:01x</dateTime> </Test> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
