title: Why DBMS_XMLSCHEMA fails to validate a valid xs:dateTime?
body: <p>I'm going to validate and process XML provided by a third party. The XML conforms a standardized XML schema also provided by a third party.</p>
  
  <p>For validation I use DBMS_XMLSCHEMA essentially this way:</p>
  
  <pre><code>-- pseudocode follows
  declare
    xmldoc xmltype;
  begin
    dbms_xmlschema.registerschema(schemaurl =&gt; name,
                                  schemadoc =&gt; xmltype(schema),
                                  local =&gt; true,
                                  gentypes =&gt; false,
                                  gentables =&gt; false
                                  );
    xmldoc := xmltype(xml).createSchemaBasedXML(schema_name);
    xmldoc.schemavalidate;
  end;
  </code></pre>
  
  <p>Validation seems to work except that I've run an issue with XML schema type <code>xs:dateTime</code> that is demonstrated below.</p>
  
  <p>With XML schema:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
    &lt;xs:element name="datetime-issue"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
          &lt;xs:element name="time" type="xs:dateTime" maxOccurs="unbounded"/&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>The validation of following XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;datetime-issue&gt;
    &lt;time&gt;2011-06-15T16:58:23&lt;/time&gt;
    &lt;!-- Oracle doesn't like timezone ? --&gt;
    &lt;time&gt;2011-06-15T16:58:23+02:00&lt;/time&gt;
    &lt;time&gt;2011-06-16T09:55:01&lt;/time&gt;
  &lt;/datetime-issue&gt;
  </code></pre>
  
  <p>Fails unexpectedly on the second time-element:</p>
  
  <pre><code>ORA-30992: error occurred at Xpath /datetime-issue/time[2]
  ORA-01830: date format picture ends before converting entire input string
  ORA-06512: at "SYS.XMLTYPE", line 354
  </code></pre>
  
  <p>AFAICS <code>2011-06-15T16:58:23+02:00</code> should be a valid XML schema <a href="http://www.w3.org/TR/xmlschema-2/#dateTime" rel="nofollow">xs:dateTime</a> value and DBMS_XMLSCHEMA should not complain about that at all. Validation should also be independent on any database date format settings, right ?</p>
  
  <p>So is this an Oracle quirk and if yes what are the workarounds ? Or should I configure Oracle and/or DBMS_XMLSCHEMA differently ? Or have I misinterpreted something or ...</p>
  
  <p>I'm running Oracle Database 11g Release 11.2.0.1.0.</p>
  
  <p>If it's worth of anything the example XML schema and data above validates correctly with <a href="http://code.google.com/p/exchangerxml/" rel="nofollow">exchangerxml</a> that uses Xerces.</p>