|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
output an interval in XML |
« View previous topic :: View next topic » |
Author |
Message
|
KIT_INC |
Posted: Thu May 03, 2018 8:33 pm Post subject: output an interval in XML |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
In my message flow, I have calculated an interval which looks like
Declare T1 interval
:
some ESQL code to calculate the interval resulting in
T1=' '00 00:00:29346' DAY TO SECOND'
when I output T1 as XML message to a file
SET OutputRoot.XMLNSC.Transaction.(XMLNSC.Field)EventInterval = T1;
The results shows
<EventInterval>PT0M0.029346S</EventInterval>
I am not sure where the PT0M0 come from. I think it may happen when IIB V10 cast the interval to character because XML output are characters.
As a matter of fact, what I want to get is just
<EventInterval>00 00:00:29346</EventInterval> but I can live with DAY TO SECOND being there.
I tried to see if I can cast T1 into char without the DAY TO SECOND' first. But I got casting error trying to cast interval to char because of the DAY TO SECOND being part of the interval. Any help on how I can get my xml output to just <EventInterval>00 00:00:29346</EventInterval> |
|
Back to top |
|
 |
timber |
Posted: Fri May 04, 2018 3:49 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
The XMLNSC parser will always write an ESQL INTERVAL as an XML Schema 'duration' data type. See https://www.w3.org/TR/xmlschema11-2/#duration
I'm tempted to ask who decided on the interval format that your XML is using. Is that defined by some standard, or did somebody in your organisation invent it? |
|
Back to top |
|
 |
KIT_INC |
Posted: Fri May 04, 2018 4:07 am Post subject: |
|
|
Knight
Joined: 25 Aug 2006 Posts: 589
|
Quote: |
I'm tempted to ask who decided on the interval format that your XML is using. Is that defined by some standard, or did somebody in your organisation invent it? |
No one has specified any standard or requirement. I was just asked to write some ESQL to read xmls generated by subscribing to broker monitoring and report any transaction that exceed SLA. So I pick up the transaction start time and transaction end time from the monitoring XML which looks like wmb:creationTime="2018-04-26T12:17:04.774342Z" and perform an interval operation. The result comes out to be ' '00 00:00:29346' DAY TO SECOND' . and I just need to output it to a xml message.
So no specific requirement. |
|
Back to top |
|
 |
timber |
Posted: Fri May 04, 2018 8:35 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
I just need to output it to a xml message.
So no specific requirement. |
In that case, I strongly advise you to use the format that XMLNSC emits. It's an international standard.
You could create an XML Schema for your data format and that specify the data type for this field as xsd:duration. Then, when another application (like IIB) wants to process your XMLl it will be easy to handle using standard code libraries. As an example, if IIB parsed that value it would create an INTERVAL in the message tree. If you create your own lexical format for an interval, that won't happen. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|