dateFormat problem xsd
564913Dec 13 2007 — edited Jan 9 2008Hi all,
I have an ESB project in which there is a file adapter. This file adapter reads files from a folder applying this files an xsd.
In each file, there is a date which can be 22-FEB-2007 or 2-FEB-2007. The problem is the day, which can be a 1 digit number or a 2 digit number.
In the xsd file, I have defined the date element like this:
<xsd:element name="FechaFin" type="xsd:dateTime" nxsd:skipMode="before"
nxsd:skip="20" nxsd:dateFormat="dd-MMM-yyyy hh:mm"
nxsd:localeLanguage="es" nxsd:style="terminated"
nxsd:terminatedBy="${eol}">
</xsd:element>
So, it works all right when the date in the source file is 22-FEB-2007, but gives an unparseable error when the date in the source file is 2-FEB-2007.
I tried doing this:
<xsd:element name="FechaFin" type="xsd:dateTime" nxsd:skipMode="before"
nxsd:skip="20" nxsd:dateFormat=’"d-MMM-yyyy hh:mm” | “dd-MMM-yyyy hh:mm"’
nxsd:localeLanguage="es" nxsd:style="terminated"
nxsd:terminatedBy="${eol}">
</xsd:element>
which again gave an unparseable error.
And also tried this:
<xsd:element name="FechaIni"
nxsd:skip="19" nxsd:skipMode="before"
nxsd:localeLanguage="es" nxsd:style="fixedLength"
nxsd:length="17">
<xsd:simpleType>
<xsd:restriction base="xsd:dateTime">
<xsd:pattern
value="([0-3])?[0-9][-][A-Z][A-Z][A-Z][-][0-2][0-2][0-9][0-9]"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
This works, I mean, the file adapter reads the file and gets the date but the element is a string, so, when i try to save that date in the database, it saves a wrong date. (string saved as date gives a wrong result)
I also tried reading the date as a string, and after that, converting that string in a dateTime type in the xsl mapping file. But again didn't work. The date gets read as a string ok, and then in the mapping file the result is a blank element.
Does anybody know how can I solve this problem? I really need help, don't know what else to do...
Thanks a lot in advance.
Zaloa