Hello,
I try to parse an XML document that contains an element that is defined as DateTime
<CreDtTm>2012-06-02T09:30:47.000Z</CreDtTm>
The xsd is as follows
<xs:element name="CreDtTm" type="ISODateTime"/>
...
<xs:simpleType name="ISODateTime">
<xs:restriction base="xs:dateTime"/>
</xs:simpleType>
To me the format looks correct, but I get
ORA-01830: date format picture ends before converting entire input string
I found http://stackoverflow.com/questions/6370035/why-dbms-xmlschema-fails-to-validate-a-valid-xsdatetime/6382096#6382096
and changed the schema:
<xs:simpleType name="ISODateTime" xdb:SQLType="TIMESTAMP WITH TIME ZONE">
Now I get
ORA-01858: a non-numeric character was found where a numeric was expected
So I tried
ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT='yyyy-mm-dd"T"hh24:mi:ss.ff3"Z"';
and tested
select systimestamp from dual;
SYSTIMESTAMP
----------------------------------------
2012-07-27T10:52:05.860Z
The exact format, but still ORA-01858.
The validation is done with
DECLARE
xmldoc XMLTYPE;
DECLARE
xmldoc XMLTYPE;
BEGIN
xmldoc := XMLTYPE(q'[<?xml version="1.0" encoding="UTF-8"?>
...
<CreDtTm>2012-06-02T09:30:47.000Z</CreDtTm>
...]');
xmldoc := xmldoc.createSchemaBasedXML('http://...xsd');
XMLTYPE.schemaValidate(xmldoc);
END;
Does anyone know where I'm wrong?
select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for HPUX: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
Regards
Marcus
Edited by: Marwim on 27.07.2012 11:45
Added db-version