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 » Creating a outputroot messge

Post new topic  Reply to topic
 Creating a outputroot messge « View previous topic :: View next topic » 
Author Message
visasimbu
PostPosted: Wed Apr 06, 2011 12:39 am    Post subject: Creating a outputroot messge Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

Hi All,

I have input XML message as shown below.

<orders xmlns="http://www.source.com/xml/impex/order/2006-10-31">
<order order-no="1">
<message-attributes>
<message-attribute xml:lang="en-us" attribute-id="1">
<value>String</value>
</message-attribute>
</message-attributes>
</order>
<order order-no="2">
<message-attributes>
<message-attribute xml:lang="en-us" attribute-id="1">
<value>String</value>
</message-attribute>
</message-attributes>
</order>
</orders>

Here i need to split the message into 2 as an different order. So i wrote code as below in compute node.

DECLARE NS NAMESPACE 'http://www.source.com/xml/order/2006-10-31';
While loop: -- to iterate each order.
SET OutputRoot.XMLNSC.NS:ROOT_ORDER.(XMLNSC.NamespaceDecl)xmlns = 'http://www.demandware.com/xml/impex/order/2006-10-31';
SET OutputRoot.XMLNSC.NS:ROOT_ORDER = InputRoot.XMLNSC.NS:orders;
PROPAGATE TO TERMINAL 'out' DELETE NONE;
End loop;

But i am getting an output like this.

<NS1:ROOT_ORDER xmlns:NS1="http://www.source.com/xml/order/2006-10-31" order-no="2">
<NS1:message-attributes>
<NS1:message-attribute xmlns:NS2="http://www.w3.org/XML/1998/namespace" NS2:lang="en-us" attribute-id="1">
<NS1:value>String</NS1:value>
</NS1:message-attribute>
</NS1:message-attributes>
</NS1:ROOT_ORDER>

Here i have 2 queries.

1) why NS1 is prefixed with each element in the output xml ? How can i avoid it.
2) why the xml:lang in input was changed to xmlns:NS2="http://www.w3.org/XML/1998/namespace" NS2:lang in output xml ?
How can i set the same thing as input in my output xml ?

Could you please help me out.

Thanks in advance.
Back to top
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Wed Apr 06, 2011 1:18 am    Post subject: Re: Creating an outputroot message Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

visasimbu wrote:
How can i set the same thing as input in my output xml?

Add explicit namespace declaration elements to the output message ... or propagate them from the input message.
Back to top
View user's profile Send private message
visasimbu
PostPosted: Wed Apr 06, 2011 4:27 am    Post subject: Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

Thanks for your reply rekarm01.

I used the declaring empty prefix in my code.

(XMLNSC.NamespaceDecl)xmlns = 'http://www.source.com/xml/impex/order/2006-10-31';

Though NS1 is prefixed in my output XML.
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Apr 06, 2011 4:51 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If you wish to control what namespace prefix is used in the message, you must explictly set the namespace prefix in the message.

Lots of previous discussion on this to a careful searcher.
Back to top
View user's profile Send private message
visasimbu
PostPosted: Wed Apr 06, 2011 5:46 am    Post subject: Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

Yes mqjeff. I dont want to prefix any namespace in my output message. As my expectation, i wrote the code for empty prefix. Though i am getting prefixed by default namespace.

For my second question.
xml:lang is the attribute. it is an valid xml as xmlspy says.

But when i post this xml in MB6.0. it takes xml prefix as namespace. If anyone know about it.. pls explain..

Thanks in advance.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Wed Apr 06, 2011 6:29 am    Post subject: Reply with quote

Grand High Poobah

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

visasimbu wrote:
Yes mqjeff. I dont want to prefix any namespace in my output message. As my expectation, i wrote the code for empty prefix. Though i am getting prefixed by default namespace.


Because you've not coded for that, as laid out in the link my most worthy associate posted. So you get the default.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Apr 06, 2011 7:24 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You don't say what version you are on.

On some versions, you occasionally have to do funny things like specify xmlns:xmlns instead of just xmlns.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Apr 06, 2011 7:40 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
For my second question.
xml:lang is the attribute. it is an valid xml as xmlspy says.

But when i post this xml in MB6.0. it takes xml prefix as namespace. If anyone know about it.. pls explain..
I don't understand the question. Maybe someone else does.
Either way, you should tell us a little more. Is this still using the XMLNSC domain, or using MRM XML ( I only ask because you are on a very old version of the product ).
Back to top
View user's profile Send private message
rekarm01
PostPosted: Wed Apr 06, 2011 10:21 pm    Post subject: Re: Creating a outputroot messge Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

visasimbu wrote:
Code:
SET OutputRoot.XMLNSC.NS:ROOT_ORDER.(XMLNSC.NamespaceDecl)xmlns = 'http://www.demandware.com/xml/impex/order/2006-10-31';

should be:
Code:
SET OutputRoot.XMLNSC.NS:ROOT_ORDER.(XMLNSC.NamespaceDecl)xmlns = NS;
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Apr 07, 2011 1:04 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

sorry - I missed your previous question about xml:lang.

Your output message tree does not contain an xmlns attribute for the xml 1998 namespace. That's because you have not copied it from InputRoot.
You can either find it in InputRoot and copy it, or you can manually create it in OutputRoot, like this:
Code:
DECLARE XML1998 NAMESPACE 'http://www.w3.org/XML/1998/namespace';
SET OutputRoot.XMLNSC.NS:ROOT_ORDER.(XMLNSC.NamespaceDecl)xmlns:xml = XML1998;
Back to top
View user's profile Send private message
visasimbu
PostPosted: Thu Apr 07, 2011 9:28 pm    Post subject: Reply with quote

Disciple

Joined: 06 Nov 2009
Posts: 171

Kimbert thanks for ur reply. For xml:lang, need fix pack 6. After fix pack it passes through to output root.

rekarm01 code you suggested also giving same output with prefix some default namespace.

If there any way to avoid the namespace prefix...


Thanks in advance.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Fri Apr 08, 2011 1:13 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
If there any way to avoid the namespace prefix...
You get a default prefix ( like NS1, NS2 etc ) when your output message tree does not contain an namespace declaration ( an xmlns attribute ) for the element's or attribute's namespace.
Please check that there is a namespace declaration for the *exact* namespace URI of the element. If you want more help, please put a Trace node immediately before the output node, and post the output here.
Back to top
View user's profile Send private message
rekarm01
PostPosted: Fri Apr 08, 2011 1:59 am    Post subject: Re: Creating an outputroot message Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

visasimbu wrote:
Code:
SET OutputRoot.XMLNSC.NS:ROOT_ORDER.(XMLNSC.NamespaceDecl)xmlns = 'http://www.demandware.com/xml/impex/order/2006-10-31';
SET OutputRoot.XMLNSC.NS:ROOT_ORDER = InputRoot.XMLNSC.NS:orders;

It's possible the second SET statement is clobbering the first SET statement, thus deleting the namespace declaration. If so, changing the order of the SET statements, or adding a VALUE clause might help:
Code:
SET OutputRoot.XMLNSC.NS:ROOT_ORDER.(XMLNSC.NamespaceDecl)xmlns = NS;
SET OutputRoot.XMLNSC.NS:ROOT_ORDER VALUE = InputRoot.XMLNSC.NS:orders;

A usertrace with Trace nodes both before and after the Compute node would provide more information.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Creating a outputroot messge
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.