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 Index » WebSphere Message Broker (ACE) Support » Apply namespace to entire input XML (SOLVED)

Post new topic  Reply to topic Goto page 1, 2  Next
 Apply namespace to entire input XML (SOLVED) « View previous topic :: View next topic » 
Author Message
maanav_kr
PostPosted: Thu Aug 24, 2017 5:13 am    Post subject: Apply namespace to entire input XML (SOLVED) Reply with quote

Novice

Joined: 19 Jan 2007
Posts: 15

Hello,

I read through multiple posts related to namespaces but wasnt able to find something which meets my current need.

Have a simple XML coming in, have to apply namespace prefix to all the tags.

Input XML
Code:

<Inquiry>
   <ServiceRequest>
      <ServiceType>LookupResponse</ServiceType>
      <WebService/>
      <CallType/>
      <PageSize/>
      <MaximumRows/>
   </ServiceRequest>
</Inquiry>


Expected Output
Code:

<s1:Inquiry xmlns:s1="http://abc.xyz.com/Inqury/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://abc.xyz.com/integration/Inquiry/v1.0 inquiry-schema.xsd ">
  <s1:ServiceRequest>
    <s1:ServiceType>LookupResponse</s1:ServiceType>
    <s1:WebService/>
    <s1:CallType/>
    <s1:PageNumber/>
    <s1:PageSize/>
    <s1:MaximumRows/
  </s1:ServiceRequest>
</s1:Inquiry>


This is what I tried :
Code:
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';           
DECLARE s1 NAMESPACE 'http://abc.xyz.com/integration/Inquiry/v1.0';
SET OutputRoot.XMLNSC.s1:Inquiry.(XMLNSC.NamespaceDecl)xmlns:s1 = s1;
SET OutputRoot.XMLNSC.s1:Inquiry.(XMLNSC.NamespaceDecl)xmlns:xsi=xsi;
SET OutputRoot.XMLNSC.s1:Inquiry.s1:ServiceRequest=InputRoot.XMLNSC.Inquiry.ServiceRequest;



Current Output :

Code:

<s1:Inquiry xmlns:s1="http://abc.xyz.com/Inquiry/v1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <s1:ServiceRequest>
      <ServiceType>LookupResponse</ServiceType>
      <WebService/>
      <CallType/>
      <PageSize/>
      <MaximumRows/>
   </s1:ServiceRequest>
</s1:Inquiry>


This compute is followed by a mapping node. Mapping node has schema attached which seems to be particular about having namespace prefix on each and every tag. I am not sure if one can turn 'OFF' this in Input Object.

Can you please point me to existing post and/or suggest alternatives to achieve expected output?


Last edited by maanav_kr on Thu Aug 24, 2017 9:39 am; edited 1 time in total
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 24, 2017 5:36 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

maanav_kr wrote:

Can you please point me to existing post and/or suggest alternatives to achieve expected output?


Search for posts by @kimber. He's talked about this many times, and suggested code to walk the tree and apply namespaces.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
maanav_kr
PostPosted: Thu Aug 24, 2017 6:05 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Novice

Joined: 19 Jan 2007
Posts: 15

Vitor wrote:

Search for posts by @kimber. He's talked about this many times, and suggested code to walk the tree and apply namespaces.


Searching

You dont recall the subject of post.. do you?
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 24, 2017 6:17 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

maanav_kr wrote:
You dont recall the subject of post.. do you?


"Applying a namespace to each XML element" IIRC.

It's been asked and answered a few times.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
maanav_kr
PostPosted: Thu Aug 24, 2017 6:29 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Novice

Joined: 19 Jan 2007
Posts: 15

Vitor wrote:
maanav_kr wrote:
You dont recall the subject of post.. do you?


"Applying a namespace to each XML element" IIRC.

It's been asked and answered a few times.


I meant the subject of the post which has the solution to my issue.. for better search results.
.. there are scores of posts by kimbert.. yet to find what I am looking for.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 24, 2017 6:38 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

maanav_kr wrote:
Vitor wrote:
maanav_kr wrote:
You dont recall the subject of post.. do you?


"Applying a namespace to each XML element" IIRC.

It's been asked and answered a few times.


I meant the subject of the post which has the solution to my issue.. for better search results.


As I remember, that was the subject of the post
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
maanav_kr
PostPosted: Thu Aug 24, 2017 7:03 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Novice

Joined: 19 Jan 2007
Posts: 15

Vitor wrote:


As I remember, that was the subject of the post


This IS the subject of current post.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Aug 24, 2017 7:27 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

maanav_kr wrote:
Vitor wrote:


As I remember, that was the subject of the post


This IS the subject of current post.


The coincidence was not lost on me, and sparked my memory leading to my original suggestion.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
maanav_kr
PostPosted: Thu Aug 24, 2017 7:46 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Novice

Joined: 19 Jan 2007
Posts: 15

Vitor wrote:

The coincidence was not lost on me, and sparked my memory leading to my original suggestion.


Thanks @Vitor

Still Searching
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 24, 2017 8:28 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Here's the basic point.

You have to apply the namespace to the entire logical message tree. Every element that needs it.

That is, you have to change *every* element to have.the right namespace.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
maanav_kr
PostPosted: Thu Aug 24, 2017 8:54 am    Post subject: Reply with quote

Novice

Joined: 19 Jan 2007
Posts: 15

mqjeff wrote:
Here's the basic point.

You have to apply the namespace to the entire logical message tree. Every element that needs it.

That is, you have to change *every* element to have.the right namespace.


I understand and that is exactly what the requirement is.

Thing is..
It seems neither a simple ESQL statement nor a property switch will can help one achieve the same.. correct?

If yes, I cant be the first one who has to deal with this.. can someone point me to a code excerpt to efficiently do the same?
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 24, 2017 8:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'm not sure what you mean by "a property switch".

Again.. You have to go through every element in the tree and set the namespace on that element.

I'm not sure how you thing "every element" can be handled by a "simple esql statement".

I mean it can, for some notion of "simple".
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
maanav_kr
PostPosted: Thu Aug 24, 2017 8:57 am    Post subject: Reply with quote

Novice

Joined: 19 Jan 2007
Posts: 15

mqjeff wrote:
I'm not sure what you mean by "a property switch".

Again.. You have to go through every element in the tree and set the namespace on that element.

I'm not sure how you thing "every element" can be handled by a "simple esql statement".

I mean it can, for some notion of "simple".


Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 24, 2017 9:02 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

maanav_kr wrote:
mqjeff wrote:
I'm not sure what you mean by "a property switch".

Again.. You have to go through every element in the tree and set the namespace on that element.

I'm not sure how you thing "every element" can be handled by a "simple esql statement".

I mean it can, for some notion of "simple".




maanav_kr wrote:
Apply namespace to entire input XML

_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
rekarm01
PostPosted: Thu Aug 24, 2017 9:18 am    Post subject: Re: Apply namespace to entire input XML Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

Vitor wrote:
Search for posts by @kimber.

You may be confusing 'kimbert' with 'timber'. Both smart people, but kimbert was more prolific about namespaces. I'm not sure that either one posted any actual code for walking through an XML message tree, element by element, but they did suggest that it might be necessary.

The Knowledge Center has some sample code that might be useful.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Apply namespace to entire input XML (SOLVED)
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.