Author |
Message
|
j.f.sorge |
Posted: Tue Jul 08, 2008 11:30 pm Post subject: [solved] Strict MRM definition of xsd:dateTime |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
Hello!
My versions are: WMBT 6.0.2.11 and WMB 6.0.0.3
I have a problem with a generated MRM. This MRM has been generated by a xsd file. The xsd contains fields which are defined as xsd:dateTime. This fields in MRM gets a physical reprensentation "DateTime Format" of yyyy-MM-dd'T'HH:mm:ssZZZ which forces me to send such a format although anything like yyyy-MM-dd'T'HH:mm:ss.SSSSSSZZZ would also be possible (if you think of xsd:dateTime).
It seems that I have to restrict the xsd:dateTime format with a regex pattern to be able to parse it in the message broker with a yyyy-MM-dd'T'HH:mm:ss.SSSSSS format.
It there any other possibility to do so?
Any help is appreciated!
Yours
J. F. Sorge
Last edited by j.f.sorge on Wed Jul 09, 2008 6:56 am; edited 1 time in total |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 09, 2008 12:19 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The MRM parser is a generic parser. It validates XML quite well, but not perfectly.
If you need 100% W3C-compliant schema validation, you need to do one of two things:
a) use support pack IA9A
b) upgrade to v6.1 and use the XMLNSC parser |
|
Back to top |
|
 |
j.f.sorge |
Posted: Wed Jul 09, 2008 4:58 am Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
kimbert wrote: |
The MRM parser is a generic parser. It validates XML quite well, but not perfectly.
If you need 100% W3C-compliant schema validation, you need to do one of two things:
a) use support pack IA9A |
That would help a lot! Thanks for the tip! The problem is that I must use the XMLNSC parser afterwards and do all the CASTs manually.
kimbert wrote: |
b) upgrade to v6.1 and use the XMLNSC parser |
Would be even nicer but I cannot see a chance for this upgrade in the near time...
My solution will be the restriction on the xsd:dateTime format to match the pattern defined in MRM. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 09, 2008 6:55 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
My solution will be the restriction on the xsd:dateTime format to match the pattern defined in MRM. |
I hate to say this but...there's a restriction in the MRM parser. It only applies Value Constraints ( i.e. facets ) to the logical value, so it cannot apply a data pattern facet to an xsd:dateTime. You can put it in the message model, but it will be ignored by the validation code. |
|
Back to top |
|
 |
j.f.sorge |
Posted: Wed Jul 09, 2008 7:03 am Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
kimbert wrote: |
Quote: |
My solution will be the restriction on the xsd:dateTime format to match the pattern defined in MRM. |
I hate to say this but...there's a restriction in the MRM parser. It only applies Value Constraints ( i.e. facets ) to the logical value, so it cannot apply a data pattern facet to an xsd:dateTime. You can put it in the message model, but it will be ignored by the validation code. |
For xsd:dateTime I created this expression
Code: |
<xs:simpleType name="st_DateTime">
<xs:restriction base="xs:dateTime">
<xs:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-2]{1}[0-9]{1}:[0-9]{2}:[0-9]{2}.[0-9]{6}"/>
</xs:restriction>
</xs:simpleType>
|
It seems to work pretty good. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 09, 2008 7:15 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
It seems to work pretty good |
Does it reject dateTime values which do not match that pattern? |
|
Back to top |
|
 |
j.f.sorge |
Posted: Wed Jul 09, 2008 7:51 am Post subject: |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
kimbert wrote: |
Quote: |
It seems to work pretty good |
Does it reject dateTime values which do not match that pattern? |
Yes, it rejects those messages which does not match the yyyy-MM-dd'T'HH:mm:ss.SSSSSS pattern which has been defined on the MRM. In addition to this the pattern rejects all different formats than the one defined in xsd when creating the XML message.
This allows me to create an interface which is valid on MRM and xsd. |
|
Back to top |
|
 |
j.f.sorge |
Posted: Tue Jul 29, 2008 6:00 am Post subject: another solution |
|
|
Master
Joined: 27 Feb 2008 Posts: 218
|
One of my collegues has shown me that IBM mentions on http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/index.jsp?topic=/com.ibm.etools.mft.doc/ad09291_.htm that you may also use a different format to solve this problem.
Quote: |
I ISO8601 Date/Time (up to yyyy-MM-dd'T'HH:mm:ss. SSSZZZ)4 Text 2006-10-07T12:06:56.568+01:00
IU ISO8601 Date/Time (similar to I, but ZZZ with output "Z" if the time zone is +00:00)4 Text 2006-10-07T12:06:56.568+01:00, 2003-12 -15T15:42:12.000Z |
The problem with this format is that you are only allowed to use three (but optional) milliseconds. If you need more (which is allowed by xsd:dateTime) it won't work. |
|
Back to top |
|
 |
|