[Xml-compile] XML::Compile::Schema::BuiltInFacets failing on a bounded dateTime

Mark Overmeer mark at overmeer.net
Fri Feb 8 21:47:18 GMT 2013


* andrew campbell (aamc_99 at yahoo.co.uk) [130208 02:07]:
> I've got the following xsd defining a datetime. 
>   <simpleType name="SpecialDateTimeType">
>           <restriction base="dateTime">
>               <minInclusive value="1995-01-01T00:00:00Z"/>
>               <maxInclusive value="2120-12-31T00:00:00Z"/>
>           </restriction>
>       </simpleType>
> 
> So when I create my data structure usually something like:
> 
> { Date => "2012-01-01T00:00:00Z" }
> 
> It passes the initial dateTime validation however I get the following failure:
> 
> error: too large inclusive 2012-01-01T00:00:00Z max NaN at {http://example.com/}Date#facet
> 
> At a guess it looks as if the inclusive and exclusive tests treat the
> values as integers. I'm wondering

It's one of the very few (documented) unsupported schema features.
I recently added something which makes supporting this possible, I think.
I'll try it this evening.

> if there is a graceful way I can switch these tests off, or make the
> tests dateTime aware.

You can always overwrite parts of a schema (often needed, because
many schema's contain bugs)  Something like this:

   $schema->importDefinitions(<<'_PATCH');
   <schema targetNamespace="???"
      xmlns="http://www.w3.org/2001/XMLSchema">
     <simpleType name="SpecialDateTimeType">
        <restriction base="dateTime"/>
     </simpleType> 
   </schema>
   _PATCH
-- 
Success,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list