ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker Supportxmlnsc parser adding an extra slash

Post new topicReply to topic
xmlnsc parser adding an extra slash View previous topic :: View next topic
Author Message
paustin_ours
PostPosted: Mon Nov 13, 2017 9:14 am Post subject: xmlnsc parser adding an extra slash Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 610
Location: columbus,oh

I have an input xml message that i parse in the MQinput node as xmlnsc.

I see a file name field getting parsed and showing up like this with extra back slashes.

\\\\hstst.mdcorp.com\\prog_fit\\testdata\\out\\testfile.txt

the actual field value in the input xml is

\\hstst.mdcorp.com\prog_fit\testdata\out\testfile.txt

this is what i see right after the message passes through the MQInput node, this is what i see in the debugger and also in the environment variable after i store it there.

not sure why it is adding the extra slash.
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Mon Nov 13, 2017 10:16 am Post subject: Re: xmlnsc parser adding an extra slash Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24614
Location: Ohio, USA

paustin_ours wrote:
not sure why it is adding the extra slash.


Because if it didn't, \h would be an escaped character. So would \p, \t, \o and \t (again). So it escapes it with a \ so the \ becomes an escaped slash.

See here

The time to worry is when the extra don't do away when it's serialized again.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Nov 13, 2017 10:19 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24614
Location: Ohio, USA

Also, and perhaps critically, it's not file:\\\\hstst.mdcorp.com\prog_fit\testdata\out\testfile.txt so it's not really a file name. Except to Windoze.

Like I said, the additional characters should disappear when you reserialize it.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paustin_ours
PostPosted: Mon Nov 13, 2017 10:43 am Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 610
Location: columbus,oh

how do i reserialize it, i am getting the input as xmlnsc, then storing that value in an environment variable. Then using it to write a JSON outputRoot.

all the while the \\\\ and \\ remains.

I got to cast as CHARACTER perhaps?
Back to top
View user's profile Send private message Yahoo Messenger
Vitor
PostPosted: Mon Nov 13, 2017 10:58 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24614
Location: Ohio, USA

paustin_ours wrote:
I got to cast as CHARACTER perhaps?


I'd be somewhat astonished if it wasn't already a character.

I think your problem is that JSON has different rules to XML, so when it's reserialized by whatever's doing the output into JSON (I assume a REST or HTTP node) the extras are acceptable.

An interesting experiment would be to try outputting it as an XMLNSC payload - this would at least prove the problem is what I think it is.

You may need a spot of code to fix this. Unless someone comes along with a better idea.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Nov 13, 2017 11:16 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19398
Location: LI,NY

Vitor wrote:
paustin_ours wrote:
I got to cast as CHARACTER perhaps?


I'd be somewhat astonished if it wasn't already a character.

I think your problem is that JSON has different rules to XML, so when it's reserialized by whatever's doing the output into JSON (I assume a REST or HTTP node) the extras are acceptable.

An interesting experiment would be to try outputting it as an XMLNSC payload - this would at least prove the problem is what I think it is.

You may need a spot of code to fix this. Unless someone comes along with a better idea.


Let's be honest here: If you did not want the \\ you should have use a java representation with forward slashes instead.

So the path would have been //hstst.mdcorp.com/prog_fit/testdata/out/testfile.txt and you would not see any escape characters.

However as long as you are looking at a file and a java representation of the windows path all \ must be escaped i.e. \\ will look like \\\\ and \ like \\
In other words what you see is normal and expected...
Have fun
_________________
MQ & Broker admin


Last edited by fjb_saper on Mon Nov 13, 2017 11:17 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
paustin_ours
PostPosted: Mon Nov 13, 2017 11:16 am Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 610
Location: columbus,oh

again all am doing is parsing the incoming xml as xmlnsc in the mq input node. then storing this field in environment variable.

then i do

OutputRoot.JSON.Data.field = env.blah.blah where i had stored the file name.

this output root is coming out with \\\\ and \\

i will try outputroot as xml see how it come out.
Back to top
View user's profile Send private message Yahoo Messenger
fjb_saper
PostPosted: Mon Nov 13, 2017 11:20 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19398
Location: LI,NY

paustin_ours wrote:
again all am doing is parsing the incoming xml as xmlnsc in the mq input node. then storing this field in environment variable.

then i do

OutputRoot.JSON.Data.field = env.blah.blah where i had stored the file name.

this output root is coming out with \\\\ and \\

i will try outputroot as xml see how it come out.

Don't bother it is a windows path and is as it should be. Only humans can dissotiate the \ character from the backslash \ ... Machines do not hence the double up on the \\.
It is as it should be. If you don't want the confusion use the Unix path version with forward slashes. Java (and I believe JSON) will accept it as a file path.
Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Mon Nov 13, 2017 11:44 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24614
Location: Ohio, USA

fjb_saper wrote:
Don't bother it is a windows path and is as it should be.


Vitor wrote:
it's not really a file name. Except to Windoze

_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Mon Nov 13, 2017 2:33 pm Post subject: Re: xmlnsc parser adding an extra slash Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1265

paustin_ours wrote:
not sure why it is adding the extra slash.

The JSON parser is adding the extra backslash characters, not the XMLNSC parser. That is a requirement for JSON strings.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker Supportxmlnsc parser adding an extra slash
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.