Author |
Message
|
anon_kb |
Posted: Tue Feb 09, 2016 3:20 am Post subject: [SPACE] Is this possible? |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
Hi guys,
I need your Input on this requirement of mine.
Input
<input1></input1>
<input2> </input2>
Output
<output1></output1>
<output2> </output2>
Is the space on Input xml field possible to map? I tried to map the empty one and it works but on the space tried to map it but it gives me an empty value instead of a space.
Is this really possible? Do we have another workaround?
Thanks. |
|
Back to top |
|
 |
maurito |
Posted: Tue Feb 09, 2016 4:38 am Post subject: Re: [SPACE] Is this possible? |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
anon_kb wrote: |
Hi guys,
I need your Input on this requirement of mine.
Input
<input1></input1>
<input2> </input2>
Output
<output1></output1>
<output2> </output2>
Is the space on Input xml field possible to map? I tried to map the empty one and it works but on the space tried to map it but it gives me an empty value instead of a space.
Is this really possible? Do we have another workaround?
Thanks. |
you will need to explain a lot better what have you done. Are you using ESQL, Java, etc. Please state exactly what you have done. |
|
Back to top |
|
 |
anon_kb |
Posted: Tue Feb 09, 2016 4:49 am Post subject: Re: [SPACE] Is this possible? |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
maurito wrote: |
anon_kb wrote: |
Hi guys,
I need your Input on this requirement of mine.
Input
<input1></input1>
<input2> </input2>
Output
<output1></output1>
<output2> </output2>
Is the space on Input xml field possible to map? I tried to map the empty one and it works but on the space tried to map it but it gives me an empty value instead of a space.
Is this really possible? Do we have another workaround?
Thanks. |
you will need to explain a lot better what have you done. Are you using ESQL, Java, etc. Please state exactly what you have done. |
Oops, Sorry. I'm using ESQL. |
|
Back to top |
|
 |
maurito |
Posted: Tue Feb 09, 2016 4:51 am Post subject: Re: [SPACE] Is this possible? |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
anon_kb wrote: |
maurito wrote: |
anon_kb wrote: |
Hi guys,
I need your Input on this requirement of mine.
Input
<input1></input1>
<input2> </input2>
Output
<output1></output1>
<output2> </output2>
Is the space on Input xml field possible to map? I tried to map the empty one and it works but on the space tried to map it but it gives me an empty value instead of a space.
Is this really possible? Do we have another workaround?
Thanks. |
you will need to explain a lot better what have you done. Are you using ESQL, Java, etc. Please state exactly what you have done. |
Oops, Sorry. I'm using ESQL. |
Well, I have just tried it and it works fine. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Feb 09, 2016 5:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
At the risk of being pedantic, how do you know it's not working? Have you examined a user trace?
I ask because if you know it's not working because the application that consumes the XML isn't getting a space, a lot of XML parsers strip leading and/or trailing spaces from XML element content. A single space in the content counts as both so it's highly possible that your ESQL code is correctly putting a space in the tag but the consuming parser is removing it, possibly before the actual application user code sees it.
Because as the previous poster correctly points out, it works fine in ESQL. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
anon_kb |
Posted: Tue Feb 09, 2016 7:20 pm Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
Vitor wrote: |
At the risk of being pedantic, how do you know it's not working? Have you examined a user trace?
I ask because if you know it's not working because the application that consumes the XML isn't getting a space, a lot of XML parsers strip leading and/or trailing spaces from XML element content. A single space in the content counts as both so it's highly possible that your ESQL code is correctly putting a space in the tag but the consuming parser is removing it, possibly before the actual application user code sees it.
Because as the previous poster correctly points out, it works fine in ESQL. |
Hi Vitor and Maurito,
Thanks for your reply. Actually I cant do debugging and user trace on my environment I just look at the output of my code on RFHUTIL and it gives me an empty tag. Anyway I'll take a look again.
@Vitor
Ohw, ok so the parser might removed the space? I use XMLNSC as parser? Is there a way that the parser will not strip a space?
Thanks guys
This is what I have tried
Code: |
SET data = Input.data
IF data = '' THEN
SET Output.data = ''
ELSE IF data = ' ' THEN
SET Output.data = ' '
END IF; |
EDIT:
I tested it using XML parser and it works. But for this complex flow that I've maintained I think converting it to XML parser is not good. |
|
Back to top |
|
 |
maurito |
Posted: Tue Feb 09, 2016 11:46 pm Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
anon_kb wrote: |
I tested it using XML parser and it works. But for this complex flow that I've maintained I think converting it to XML parser is not good. |
so, why don't you explain what your "complex flow" is doing ? Is that flow written in ESQL ? If it is not, then testing in ESQL has no validity.
As for debugging, you can easily install IIB in your private laptop and debug in it. Or fix the reason why you cannot debug and get a user trace. |
|
Back to top |
|
 |
anon_kb |
Posted: Wed Feb 10, 2016 12:10 am Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
maurito wrote: |
anon_kb wrote: |
I tested it using XML parser and it works. But for this complex flow that I've maintained I think converting it to XML parser is not good. |
so, why don't you explain what your "complex flow" is doing ? Is that flow written in ESQL ? If it is not, then testing in ESQL has no validity.
As for debugging, you can easily install IIB in your private laptop and debug in it. Or fix the reason why you cannot debug and get a user trace. |
I'm using ESQL. I have an IIB last time (used it for around 7 months) but I dont know what happen it suddenly cant deploy and cant find the MQ I've reinstalled it and same problem. Anyway thanks for your suggestion Maurito. Already explain it to the Client. |
|
Back to top |
|
 |
timber |
Posted: Wed Feb 10, 2016 1:33 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Please answer both of these questions:
a) is validation enabled in your message flow?
b) does the xsd have a whitespace facet on the simple type that describes this 'empty' tag.
I agree with maurito - you need to get a development environment where you can install IIB and try things out. |
|
Back to top |
|
 |
anon_kb |
Posted: Wed Feb 10, 2016 3:31 am Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
timber wrote: |
Please answer both of these questions:
a) is validation enabled in your message flow?
b) does the xsd have a whitespace facet on the simple type that describes this 'empty' tag.
I agree with maurito - you need to get a development environment where you can install IIB and try things out. |
Tried to reinstall the IIB which I have been using for around 7 months and I still get an error.. * please do not use *. Thanks for this forum i survived nearly a year without the option to debug and user trace. I just use manual debugging like commenting some of the codes to trace the issue and output the error manually using inputexceptionlist.
For your questions:
a. Validation is not enabled(I dont know this one but I'm gonna search for the function of this)
b. xsd? for message set right? I dont have any xsd. I just have this input xml with a xml field that has a space.
Thanks for the reply guys. |
|
Back to top |
|
 |
maurito |
Posted: Wed Feb 10, 2016 3:43 am Post subject: |
|
|
Partisan
Joined: 17 Apr 2014 Posts: 358
|
anon_kb wrote: |
xsd? for message set right? I dont have any xsd. I just have this input xml with a xml field that has a space.
|
so, is your input message self defining XML ? or you have a message set to describe it ( MRM, DFDL ). Do you have an XSD for the output message ( again, message set ) ? |
|
Back to top |
|
 |
anon_kb |
Posted: Wed Feb 10, 2016 4:29 am Post subject: |
|
|
Acolyte
Joined: 13 Nov 2014 Posts: 74
|
maurito wrote: |
anon_kb wrote: |
xsd? for message set right? I dont have any xsd. I just have this input xml with a xml field that has a space.
|
so, is your input message self defining XML ? or you have a message set to describe it ( MRM, DFDL ). Do you have an XSD for the output message ( again, message set ) ? |
Hi maurito no message on it. it is self defining. No xsd also for the output. Just a normal way on mapping a message from an input xml to its equivalent on Output xml. An xml field with a space on input xml must have a value of space also on output.
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Wed Feb 10, 2016 5:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Ok, so this still works for me on my IBv9.0.0.4
It's possible that if your environment is back level / hosed up (i.e. none of the debugging tools don't work) that's causing this.
I agree with the crowd that something's causing the whitespace in the output to be collapsed. If not the receiving parser as I suggested, something that IIB can see. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Feb 10, 2016 6:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Is the space part of the content of an element with no children, or part of an element that has children. That is, is the space part of "mixed content"?
Even with self-defining XML, you should use the XMLNSC parser.
Have you taken a trace of the message tree before you do something to serialize the message?
Have you examined the options on whatever you are using to serialize the message - the xmlnsc/parser options in particular. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
timber |
Posted: Wed Feb 10, 2016 8:39 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
I dont have any xsd |
Thanks - that's helpful. That means that it is not XMLNSC removng the white space, unless there is a bug in XMLNSC.
You *really* need to clean up your system and install the ( free ) Developer edition of IIB. It may take a while, but it will save you hours. |
|
Back to top |
|
 |
|