title: Modify xsd:dateTime simple type to use different date-and-time separator
body: <p>I have a legacy system that produces XML with timestamps similar to ISO 8601, but with space used to separate date and time. E.g. <em>2009-12-31 00:00:00</em>. I would like to define a schema that defines the possible range for these timestamps. <code>xsd:dateTime</code>would be well suited for that purpose, however, it uses <em>T</em> as the separator between date and time. I cannot modify the legacy system to return timestamps using T as a separator.</p>
  
  <p>Is there a way to have a <code>simpleType</code>definition that derives from <code>xsd:dateTime</code>, but alters the separator or do I have to rely on a string with an appropriate pattern and human readable comments?</p>
  
  <p><strong>Update:</strong> As I understand, I can use a pattern for dateTime to restrict the range of dateTime objects for input, but this does not alter the separator character.</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;xs:restriction base="xs:dateTime"&gt;
    &lt;xs:pattern value="[2].*:[0-9]{2}"/&gt;
  &lt;/xs:restriction&gt;
  </code></pre>
  
  <p>This would only allow for dateTime with years starting with 2000 and without fractional seconds and time zone information.</p>
  
  <p><strong>Summary of answers</strong>:</p>
  
  <p>It is not possible to use <code>xs:dateTime</code> as the base type for this. It is however possible to use <code>xs:string</code>and define a pattern.</p>
  
  <pre><code>&lt;xs:restriction base="xs:string"&gt;
    &lt;xs:pattern value="[0-9]{4}-[01][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-6][0-9]"/&gt;
  &lt;/xs:restriction&gt;
  </code></pre>
  
  <p>By using a string, of course, any automatic tools that use the Schema to create language bindings will also retrieve a string, conversion to the appropriate language type for date/time has to be done by hand.</p>