|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Automatically setting the xsi:nil Attribute |
« View previous topic :: View next topic » |
Author |
Message
|
Seb |
Posted: Tue Jul 21, 2009 4:20 am Post subject: Automatically setting the xsi:nil Attribute |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Hi,
I am mapping messages from CWF to XML. Getting e.g. an empty date element from the host represented with 00000000, I use the NullLogicalValue Property to set the element's value to NULL.
Thus, the XML representation goes from <date>0</date> to <date/>
However, when it comes to validation the element is not valid (even if it is specified as "nillable" in the msg def). What I need is <date xsi:nil="true"/>
Is there any way to get the xsi:nil attribut set automatically for such elements with a NULL value or do I have to code that myself?
btw:
I already read this, but am still in hope
Note that the XMLNSC parser only outputs xsi:nil attributes that are already in the messsage tree. It does not automatically output xsi:nil attributes for all message tree elements that have a NULL value and are 'nillable'.
Thanks in advance!
Seb |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 21, 2009 1:34 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
XMLNSC does not use *any* information from the XML physical format. So I'm afraid you have two options
- Use XMLNSC and add the xsi:nil attribute yourself
- Use MRM XML ( and pay a big price in CPU usage ) and get the xsi:nil attribute generated automatically |
|
Back to top |
|
 |
Seb |
Posted: Tue Jul 21, 2009 10:11 pm Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Hi kimbert,
many thanks for your information.
Actually my problem is that I always have to create the complete message with all elements, where empty elements are marked xsi:nil="true". Having several business cases, where certain fields are filled an others not depending on the case, I had to move through the logical tree, test if a certain field is NULL and add the Attribut if it is with XMLNSC.
Thus, I am really thinking MRM could be the better choice in my case. And 2 x 200.000 4kb Request Msgs and 2x 200.000 1kb Response Msgs are not that much. |
|
Back to top |
|
 |
Seb |
Posted: Tue Jul 21, 2009 10:13 pm Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
Hi kimbert,
many thanks for your information.
Actually my problem is that I always have to create the complete message with all elements, where empty elements are marked xsi:nil="true". Having several business cases, where certain fields are filled an others not depending on the case, I had to move through the logical tree, test if a certain field is NULL and add the Attribut if it is with XMLNSC.
Thus, I am really thinking MRM could be the better choice in my case. And 2 x 200.000 4kb Request Msgs and 2x 200.000 1kb Response Msgs per year are not that much. |
|
Back to top |
|
 |
Seb |
Posted: Wed Jul 22, 2009 5:19 am Post subject: |
|
|
Apprentice
Joined: 27 Mar 2009 Posts: 41
|
@ kimbert,
could you please tell if this works as designed:
Using the XMLNSC Parser after an XSL Node, I get empty fields as empty fields. The output is <element/> ... without xsi:nil as described above
Using the MRM/XML Parser after the XSL Node, I get empty decimal fields filled with a "0". However the output again is <element/> ... again without xsi:nil
Setting the value of those fields explicitly to NULL, the output gets to <element xsi:nil="true"/> with MRM.
Thus, the question is, where does the "0" come from? As far as I know there are no default values on the MRM/XML Parser. And even if, why is the element an empty element in the output and not <element>0</element>? |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 22, 2009 2:40 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Thus, I am really thinking MRM could be the better choice in my case |
I agree - but I have noted that XMLNSC is second-best choice here, and that's a situation which I would like to see corrected.
Quote: |
I get empty decimal fields filled with a "0" |
Not sure what you mean. Are you talking about the logical message tree? If so, a decimal field would not contain "0" - it would contain the DECIMAL value 0.
Quote: |
why is the element an empty element in the output and not <element>0</element>? |
If you have not modified the message tree, the MRM parser will reuse the input bit stream. Maybe that's the explanation, although there are other possibilities. |
|
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
|
|
|
|