Author |
Message
|
gotnoid |
Posted: Wed Oct 06, 2010 1:48 pm Post subject: XML to BLOB to XML |
|
|
Novice
Joined: 20 Nov 2008 Posts: 15
|
Hi, here is the requirement.
Flow 1 does the following,
DECLARE msgBitStream BLOB ASBITSTREAM(InputRoot.XMLNS, inEncoding, inCCSID);
DECLARE msgChar CHAR CAST(msgBitStream AS CHAR CCSID inCCSID);
then the flow persists the field to a database.
Flow 2 needs to do the following,
Read the value from the column and place it as a valid input to another flow.
Problem seems to be as follows, when Flow 2 gets the data from the database, what I see is that the data has the spaces, tabs and new line characters in it. Which I believe are embedded when the ASBITSTREAM tries to convert the logical tree into a bit stream.
When Flow 2 places the message to the third flow it is parsed well, but then the new logical tree also has the new line characters and spaces included.
Actual message : <A><B>ABCD</B></A>
MESSAGE TREE :
<A>
. <B>
. ABCD
Character String : <A>\n <B>ABCB</B>\n </A>
New Message Tree :
<A>
. \n
. <B>
. ABCD
. \n
New XML message : is not one lined but has been tabbed and formatted, I need one lined.
Sorry if the post is missing more information than it is providing. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Oct 06, 2010 2:06 pm Post subject: Re: XML to BLOB to XML |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
gotnoid wrote: |
New XML message : is not one lined but has been tabbed and formatted, I need one lined. |
How do you know? Is it not likely that whatever you're using to view the XML is formatting it for you? In terms of syntax there's no difference between a document with one tab per line or one big line.
If there's really extra linefeeds and so forth inside the tag then something is adding them. Either fix the flow not to add them or code the flow to remove them. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 06, 2010 11:33 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
what I see is that the data has the spaces, tabs and new line characters in it. Which I believe are embedded when the ASBITSTREAM tries to convert the logical tree into a bit stream. |
Fact : ASBITSTREAM does not add whitespace to an XML document. There is no 'pretty print' option in any WMB XML domain. Some other application / process / WMB node is adding the whitespace. |
|
Back to top |
|
 |
gotnoid |
Posted: Thu Oct 07, 2010 3:31 am Post subject: |
|
|
Novice
Joined: 20 Nov 2008 Posts: 15
|
@vitor
there are no additions within the payload of a tag, the additions are between tag A and tag B but not within the same tag.
I know that the format has changed because, when i see logical tree for the XML child in debug, i see that it has \n's. Also when I view it as a character in the RFHUTIL i see the difference.
@ Kimbert
I Think ASBITSTREAM is just trying to preserve the look of the logical tree, hense the new line characters between the different tags in the xml.
can you give it a try and see, pardon me if I am being rude. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 07, 2010 4:35 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
gotnoid wrote: |
I know that the format has changed because, when i see logical tree for the XML child in debug, i see that it has \n's. Also when I view it as a character in the RFHUTIL i see the difference. |
a) That doesn't change the format of an XML document.
b) I repeat that WMB doesn't just add stuff
gotnoid wrote: |
I Think ASBITSTREAM is just trying to preserve the look of the logical tree, hense the new line characters between the different tags in the xml. |
That doesn't even make sense. Extra whitespace between tags doesn't change the logical layout of an XML document.
gotnoid wrote: |
can you give it a try and see, pardon me if I am being rude. |
Given what kimbert does for a day job, if he says it's a fact you can pretty much rely on that.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Oct 07, 2010 4:37 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
can you give it a try and see, pardon me if I am being rude. |
Sorry, but no. I don't need to try this to know the answer. I have written or maintained most of the parsers used by WMB. I can assure you that the XMLNSC parser *never* adds white space to the output message unless it is already there in the message tree. In case the question arises, neither do XML / XMLNS or MRM XML.
Quote: |
I Think ASBITSTREAM is just trying to preserve the look of the logical tree |
That's nice theory, but it's completely wrong. There is no such thing as the 'look' of the message tree. The indented view shown by the debugger or the Trace node is just a nice, easy-to-read rendering of a purely logical structure. Message broker does everything possible to *separate* the logical message tree from the physical format of the message.
You need to trace the execution of your message flow until you find out who or what is adding the white space. If necessary, that means inspecting the bitstream/message tree before and after every node in your message flow. |
|
Back to top |
|
 |
gotnoid |
Posted: Thu Oct 07, 2010 4:43 am Post subject: |
|
|
Novice
Joined: 20 Nov 2008 Posts: 15
|
Thanks guys, will look into to from a different angle. Will post back if find the where the mod is taking place.
No disrespect meant Vitor and Kimbert  |
|
Back to top |
|
 |
gotnoid |
Posted: Thu Oct 07, 2010 11:26 am Post subject: |
|
|
Novice
Joined: 20 Nov 2008 Posts: 15
|
Vitor,
looks like it boils down to removing the unwanted things in the XML, and based off of a previous post by you using the XMLNSC solves the issue.
Thanks for pointing me in the direction guys. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Oct 07, 2010 11:47 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
gotnoid wrote: |
looks like it boils down to removing the unwanted things in the XML, and based off of a previous post by you using the XMLNSC solves the issue. |
It's the C in XMLNSC that makes the difference.
gotnoid wrote: |
Thanks for pointing me in the direction guys. |
You're quite welcome. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|