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 » Is it possible to add xmlns declaration to existing element

Post new topic  Reply to topic
 Is it possible to add xmlns declaration to existing element « View previous topic :: View next topic » 
Author Message
yortch
PostPosted: Mon Aug 30, 2004 5:05 pm    Post subject: Is it possible to add xmlns declaration to existing element Reply with quote

Apprentice

Joined: 30 Aug 2004
Posts: 34

Is it possible to add a xmlns declaration to an existing element in an XML document? I'm using WBI MB 5 FP3, I'm not an expert in ESQL so hopefully this is something trivial.

I'm trying to get from this:

Code:
<GetQuote><test>123</test></GetQuote>


...to this:

Code:
<GetQuote xmlns="http://tempuri.org"><test>123</test></GetQuote>


This is what I tried so far:

Code:
DECLARE sp1 NAMESPACE 'http://tempuri.org/';
SET OutputRoot.XMLNS = InputRoot.XMLNS;
SET OutputRoot.XMLNS.sp1:GetPurRedData.(XML.NamespaceDecl)xmlns = sp1;


But this doesn't seem to work. I was initially trying to achieve this using a MessageSet with XMLNS enabled but for some reason, the xmlns declaration never gets added to the root element, only to child elements, so this defeats the purpose of what I want to do. Any help with either approach will be appreciated.

Thanks!
Jorge
Back to top
View user's profile Send private message
shanson
PostPosted: Tue Aug 31, 2004 4:21 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

The problem is that the input message is not using namespaces, so when parsed the elements are not in any namespace. As well as declaring a namespace you have to set the namespace of the elements to be in that namespace. The following ESQL should do it.

DECLARE sp1 NAMESPACE 'http://tempuri.org/';
SET OutputRoot.XMLNS = InputRoot.XMLNS;
SET OutputRoot.XMLNS.GetQuote NAMESPACE = sp1;
SET OutputRoot.XMLNS.sp1:GetQuote.test NAMESPACE = sp1;
SET OutputRoot.XMLNS.sp1:GetQuote.(XML.NamespaceDecl)xmlns = sp1;

Note that once the namespace has been set on GetQuote it must be referenced using that namespace.
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 » Is it possible to add xmlns declaration to existing element
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.