Author |
Message
|
phaniIIB |
Posted: Wed Sep 09, 2015 5:50 am Post subject: How to convert an XMLNSC message into String |
|
|
Acolyte
Joined: 28 Jul 2015 Posts: 51
|
Can anyone suggest how to convert an XMLNSC message into String in Java compute node |
|
Back to top |
|
 |
Vitor |
Posted: Wed Sep 09, 2015 5:58 am Post subject: Re: How to convert an XMLNSC message into String |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
phaniIIB wrote: |
Can anyone suggest how to convert an XMLNSC message into String in Java compute node |
Why on Earth would you want or need to?
Is it because your XPath still isn't working? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 09, 2015 6:03 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
By using the same method that converts any logical message tree into a serialized form. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
phaniIIB |
Posted: Wed Sep 09, 2015 6:14 am Post subject: |
|
|
Acolyte
Joined: 28 Jul 2015 Posts: 51
|
Because I wanted to trim the XML message as follows,
Code: |
string.replace("\n"," ").replace("\r", " ").replaceAll("[\\t\\n\\r]+", "").trim().replaceAll(" +"," "); |
The above code indicates trimming a string. Can you please suggest how to trim an XML message.
My thought was to convert an XML into string and perform the above task. |
|
Back to top |
|
 |
smdavies99 |
Posted: Wed Sep 09, 2015 6:19 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Does the XMLNSC parser not remove all that crud when it parses the input message?
So, are you sure that EACH and EVERY component of the message tree that you are dealing with has things like a CRLF at the end of it?
Just because the input message may have them in order to make them look pretty in some message viewers it dow not mean that they are there after the message has been parsed.
Has someone told you do this? If not how did you come to the conclusion that you need to this?
Remember that you are dealing with a message tree. This is why we tell java developers that Broker is not a J2EE server/engine. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Last edited by smdavies99 on Wed Sep 09, 2015 6:21 am; edited 1 time in total |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 09, 2015 6:20 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Why do you think you need to do this for an XML document?
The only reason an XML document would have these characters in it is if they were supposed to be there, for some value of 'supposed'.
If you did in fact trim these characters, you could actually end up damaging the business meaning of the document.
Go back to square one, and revisit your requirement and what format the data should come into your flow as.
Then revisit the notion that every thing inside a message flow is a logical message tree, and remember what you were taught about trees. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
|