Author |
Message
|
jr_martin |
Posted: Wed Sep 08, 2010 9:02 am Post subject: LineFeed issue |
|
|
 Apprentice
Joined: 24 Aug 2005 Posts: 36 Location: NY
|
Hi,
How do I achieve the following expected output? I want to add the linebreak to whole xml tag, not just the value.
SET CR = CAST(x'0A' AS CHARACTER CCSID InputRoot.Properties.CodedCharSetId);
SET OutputRoot.XMLNSC.from = NY || CR;
SET OutputRoot.XMLNSC.to = BOSTON || CR;
Output:
<from>NY
</from>
<to>BOSTON
</to>
Expected Output:
<from>NY</from>
<to>BOSTON</to>
--
Environment:
WMB6.1.0.3 @ Solaris |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 08, 2010 9:15 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
In fact, you don't want to do this. XML is not intended to be viewable and readable by human beings. Efforts to make it so are best left for XML editors.
NO PROGRAM THAT PROCESSES XML should be reliant on the existence or non-existence of whitespace elements in the element content. |
|
Back to top |
|
 |
jr_martin |
Posted: Wed Sep 08, 2010 9:30 am Post subject: |
|
|
 Apprentice
Joined: 24 Aug 2005 Posts: 36 Location: NY
|
Thanks for the reply.
Operations wants this line break, so that they can find (grep) the required message (grep "BOSTON" abc.xml) in the file system (unix) with less difficulty and post the messages to other systems for performance testing.Without line break, they see whole abc.xml for grep command. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Sep 08, 2010 10:10 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jr_martin wrote: |
Operations wants this line break |
I want $10,000,000 but it's a cruel & unfair universe.
jr_martin wrote: |
post the messages to other systems for performance testing. |
Post how? Using what? Indeed, posting what? What value does one tag out of an XML document (and I'm assuming from your grep that the broker outputs the finished XML to a file) have for performance testing? Is someone trying to prove their application goes faster if you only feed it one tag instead of the whole document??
If you are really prepared to give in to your opperations people (who really should try thinking rather than ask for ludicrous solutions) then you need to recode your flow to use XMLNS rather than XMLNSC. This will stop the CR (which is whitespace in an XML document) being stripped out.
Note that that not only means changing each XMLNSC to XMLNS but also changing all the constants you may be using through the flow. You'll also pay in performance as the XMLNSC is considerably more efficient than the XMLNS one. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 08, 2010 11:05 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Code: |
perl -wp -e "s/></>\n</g;" |
? |
|
Back to top |
|
 |
jr_martin |
Posted: Wed Sep 08, 2010 11:57 am Post subject: |
|
|
 Apprentice
Joined: 24 Aug 2005 Posts: 36 Location: NY
|
Thank you.
The messageflow reads from database and posts messages to queues for downstream processing (this requires no linebreak).
We created a MQ java program for operations to dequeue the messages from queues and create xml files in unix file system.
These messages will be manually posted (again using MQ java program) to other environments for performance testing.
We plan to handle line break in MQ java program. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Sep 08, 2010 2:05 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
mqjeff said:
Quote: |
NO PROGRAM THAT PROCESSES XML should be reliant on the existence or non-existence of whitespace elements in the element content. |
In general, this is true. If the sender really wants the receiver to pay attention to ignorable whitespace within a tag then it should put an xml:space attribute on the tag or one of its parent tags. |
|
Back to top |
|
 |
|