Author |
Message
|
javaforvivek |
Posted: Mon May 23, 2005 11:30 pm Post subject: Empty XML Tags |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
I have following input:
<Transaction>
<TotalAmount>67.89</TotalAmount>
<TotalVATAmount/>
</Transaction>
And I want following output:
<BusinessObject>
<Amount>67.89</Amount>
<VATAmount></VATAmount>
</BusinessObject>
I tried following:
I created two msg sets (Transaction and BusinessObject) with XML1 formats.
In my msg flow, MQInput Node sets parser to MRM and format to XML1 (so that I can validate the input msg).
Then use RCD to change the parser from MRM to XML.
Then is the mapping node to map Transaction to BusinessObject.
The output that I got is:
<BusinessObject>
<Amount>67.89</Amount>
<VATAmount>0</VATAmount>
</BusinessObject>
In my Transaction Msg Set, both TotalAmount and TotalVATAmount are local elements of type decimal.
Why does this extra '0' appears in my output <VATAmount>?? _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 24, 2005 1:51 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Is it a default value in your model? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
javaforvivek |
Posted: Tue May 24, 2005 1:53 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
No. I haven't given any default value in my msg def.
Actually, when the msg enters the flow, the parser itself assigns the value of '0' to this element. _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 24, 2005 1:55 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
javaforvivek wrote: |
No. I haven't given any default value in my msg def.
Actually, when the msg enters the flow, the parser itself assigns the value of '0' to this element. |
Ah. So it's a Null Element rendering option.
You could play with that in your model, or you could add something to set the value of the element to null. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
javaforvivek |
Posted: Tue May 24, 2005 2:03 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
Have you encountered this problem earlier? Like, the parser assigns an unwanted value to an empty tag?
I had my flow in debug perspective and checked it. The tree looked like this:
Message
Properties
MQMD
MRM
TotalAmount = 67.89
TotalVATAmount = 0
From where does this zero come? I need to use MRM parser because I want to validate my input msg against the msg set.
Further I used mapping node to map input to output. Now I am planning to use compute node and build my output msg tree through ESQL code.
If you want I can email you my mxsd and you can check it. _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue May 24, 2005 3:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
javaforvivek |
Posted: Tue May 24, 2005 4:17 am Post subject: |
|
|
 Master
Joined: 14 Jun 2002 Posts: 282 Location: Pune,India
|
From your link I found following:
Quote: |
The properties Encoding Null Num Val and Encoding Null Non-Num Val provide a value (if needed) to represent a null value. For an element of type string, this might be null or unspecified while for a number it might be 0 or 0.0.
|
In my msg set messageset.mset, I have created a physical format XML1.
In this I have following:
XML representation of null value
Encoding Numeric Null - NullEmpty
Encoding Numeric Null Value - disabled
Encoding Non-Numeric Null - NullEmpty
Encoding Non-Numeric Null Value - disabled
Now, where possibly do I have the value of 0 setup? _________________ Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth. |
|
Back to top |
|
 |
|