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 » Namespace declaration

Post new topic  Reply to topic
 Namespace declaration « View previous topic :: View next topic » 
Author Message
Muthukrishnan
PostPosted: Sun Jun 30, 2013 8:17 pm    Post subject: Namespace declaration Reply with quote

Apprentice

Joined: 16 Feb 2013
Posts: 48

Hi

I have an issue

I have written a piece of code

Code:
DECLARE oagis9 NAMESPACE 'http://www.openapplications.org/oagis/9';
DECLARE gic NAMESPACE 'http://www.gic.michelin.com/oagis/9/michelin/1';
CREATE COMPUTE MODULE WMB_D19_PROD3PL_SUB00_001_D19_PROD3PL
   CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      CALL CopyMessageHeaders();
      -- CALL CopyEntireMessage();   
      DECLARE rowCnt INTEGER 0;
      DECLARE LineCount INTEGER 1;
      SET rowCnt = rowCnt+1;
      -- Construct Final Response XML
      SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Version = '1.0';
      SET OutputRoot.XMLNSC.(XMLNSC.XmlDeclaration)*.(XMLNSC.Attribute)Encoding = 'UTF-8';
      SET OutputRoot.XMLNSC.gic:SyncItemMaster.(XML.NamespaceDecl)xmlns= oagis9;
      SET OutputRoot.XMLNSC.gic:SyncItemMaster.(XML.NamespaceDecl)xmlns:gic= gic;
      CREATE FIELD OutputRoot.XMLNSC.gic:SyncItemMaster;          
      SET OutputRoot.XMLNSC.gic:SyncItemMaster.*:ApplicationArea.*:Sender = InputRoot.XMLNSC.*:SyncItemMaster.*:ApplicationArea.*:Sender;
      SET OutputRoot.XMLNSC.gic:SyncItemMaster.*:ApplicationArea.*:CreationDateTime = InputRoot.XMLNSC.*:SyncItemMaster.*:ApplicationArea.*:CreationDateTime;
      SET OutputRoot.XMLNSC.gic:SyncItemMaster.*:ApplicationArea.*:BODID = InputRoot.XMLNSC.*:SyncItemMaster.*:ApplicationArea.*:BODID;
      SET OutputRoot.XMLNSC.gic:SyncItemMaster.*:ApplicationArea.*:UserArea.*:MichEnvironment='CQT';
and so.. on


The output comes like

Code:
<?xml version="1.0" encoding="UTF-8"?>
<NS1:SyncItemMaster xmlns:NS1="http://www.gic.michelin.com/oagis/9/michelin/1">
 <ApplicationArea>
  <Sender>
   <NS2:LogicalID xmlns:NS2="http://www.openapplications.org/oagis/9">RAG</NS2:LogicalID>
  </Sender>
  <CreationDateTime>2013-06-14T07:50:32.309593</CreationDateTime>
  <BODID>BMIAA0Q20130614055342355447</BODID>
  <UserArea>
   <MichEnvironment>CQT</MichEnvironment>
   <MichSender>CN</MichSender>
   <MichReceiver>Sinotrans_SHA_CN</MichReceiver>


But I need

Code:
<?xml version="1.0" encoding="UTF-8"?>
<SyncItemMaster xmlns="http://www.openapplications.org/oagis/9" xmlns:gic="http://www.gic.michelin.com/oagis/9/michelin/1">
  <ApplicationArea>
   


How do I remove the NS1 and NS2 .
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Sun Jun 30, 2013 9:55 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

This question has been asked before. did you search for previous answers?
_________________
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.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jun 30, 2013 9:57 pm    Post subject: Reply with quote

Grand High Poobah

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

you should not care about NS1 or NS2. Those are technicalities and there is more than 1 way to declare a valid xml namespace.

What you should care much more about is that you have defined
Code:
 SET OutputRoot.XMLNSC.gic:SyncItemMaster.(XML.NamespaceDecl)xmlns= oagis9;
      SET OutputRoot.XMLNSC.gic:SyncItemMaster.(XML.NamespaceDecl)xmlns:gic= gic;
where you should have defined
Code:
 SET OutputRoot.XMLNSC.oasis9:SyncItemMaster.(XMLNSC.NamespaceDecl)xmlns= oagis9;
      SET OutputRoot.XMLNSC.oasis9:SyncItemMaster.(XMLNSC.NamespaceDecl)xmlns:gic= gic;


Maybe these little changes would help?
You declared the folder in the wrong namespace and forgot that namespace declarations are parser specific...

The create field SyncItemMaster should not be necessary, already done in the above segment implicitely

Also when creating a field (or path) for the first time you HAVE to specify the namespace. A * will not do.

See
Code:
SET OutputRoot.XMLNSC.oasis9:SyncItemMaster.oasis9:ApplicationArea.oasis9:CreationDateTime = InputRoot.XMLNSC.*:SyncItemMaster.*:ApplicationArea.*:CreationDateTime;


Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Muthukrishnan
PostPosted: Mon Jul 08, 2013 4:38 am    Post subject: Reply with quote

Apprentice

Joined: 16 Feb 2013
Posts: 48

H fjb_saper,

Sorry for the delay.Tried your code. But still the namespaces NS1,NS2 are not removed. Could you please advice if anything I missed.


Code:


SET OutputRoot.XMLNSC.oasis9:SyncItemMaster.oasis9:ApplicationArea.oasis9:CreationDateTime = InputRoot.XMLNSC.*:SyncItemMaster.*:ApplicationArea.*:CreationDateTime;

Back to top
View user's profile Send private message Send e-mail
kash3338
PostPosted: Mon Jul 08, 2013 6:19 am    Post subject: Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

This code given by fjb_saper should work as you require,

Code:
SET OutputRoot.XMLNSC.oagis9:SyncItemMaster.(XMLNSC.NamespaceDecl)xmlns= oagis9;
         SET OutputRoot.XMLNSC.oagis9:SyncItemMaster.(XMLNSC.NamespaceDecl)xmlns:gic= gic;
         
         SET OutputRoot.XMLNSC.oagis9:SyncItemMaster.oagis9:ApplicationArea.oagis9:CreationDateTime = CURRENT_TIMESTAMP;


This is what the output would look like for above code,

Code:

<SyncItemMaster xmlns="http://www.openapplications.org/oagis/9" xmlns:gic="http://www.gic.michelin.com/oagis/9/michelin/1">
   <ApplicationArea>
      <CreationDateTime>2013-07-08T19:48:25.298412</CreationDateTime>
   </ApplicationArea>
</SyncItemMaster>
Back to top
View user's profile Send private message Send e-mail
Muthukrishnan
PostPosted: Mon Jul 08, 2013 10:31 pm    Post subject: Reply with quote

Apprentice

Joined: 16 Feb 2013
Posts: 48

Thanks kashyap.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Namespace declaration
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.