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 manipulation in XMLNSC parser

Post new topic  Reply to topic
 Namespace manipulation in XMLNSC parser « View previous topic :: View next topic » 
Author Message
nobody
PostPosted: Wed Jun 06, 2007 8:05 am    Post subject: Namespace manipulation in XMLNSC parser Reply with quote

Newbie

Joined: 06 Jun 2007
Posts: 3

Hi

I have an incoming message which when looking through the debugger gives me 2 or more namespace declarations. One of the namespaces is not required and have no idea on how to search for its existence and how then to remove it leaving the others in place as it is not really a field but an attribute is it not and can't find a field type to compare it against if i looped through the message. Having searched the books and the forum for similar. TIA.
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Jun 06, 2007 10:11 am    Post subject: Re: Namespace manipulation in XMLNSC parser Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

Here you have 2 procedures.
Check this code and modify it for your requirement.

Code:
CREATE PROCEDURE StripNamespaces(IN StartRefPtr REFERENCE)
BEGIN
DECLARE FieldRefPtr REFERENCE TO StartRefPtr;

MOVE FieldRefPtr FIRSTCHILD;
IF LASTMOVE(FieldRefPtr) THEN
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) THEN
SET FieldRefPtr.(XML.NamespaceDecl)* = NULL;
SET FieldRefPtr NAMESPACE = '';
END IF;
END IF;

WHILE LASTMOVE(FieldRefPtr) DO
CALL StripNamespaces(FieldRefPtr);
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) THEN
SET FieldRefPtr.(XML.NamespaceDecl)* = NULL;
SET FieldRefPtr NAMESPACE = '';
END IF;
MOVE FieldRefPtr NEXTSIBLING;
END WHILE;
END;



   
CREATE PROCEDURE SetNamespaces(IN StartRefPtr REFERENCE, IN namespace CHARACTER)
BEGIN
DECLARE FieldRefPtr REFERENCE TO StartRefPtr;

MOVE FieldRefPtr FIRSTCHILD;
IF LASTMOVE(FieldRefPtr) THEN
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) THEN
SET FieldRefPtr.(XML.NamespaceDecl)* = NULL;
SET FieldRefPtr NAMESPACE = '';
END IF;
END IF;

WHILE LASTMOVE(FieldRefPtr) DO
CALL SetNamespaces(FieldRefPtr,namespace);
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) THEN
SET FieldRefPtr.(XML.NamespaceDecl)* = NULL;
SET FieldRefPtr NAMESPACE = namespace;
END IF;
MOVE FieldRefPtr NEXTSIBLING;
END WHILE;
END;

_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
special_agent_Queue
PostPosted: Wed Jun 06, 2007 10:38 am    Post subject: Reply with quote

Centurion

Joined: 27 Jul 2006
Posts: 102

I don't think nobody wants to remove namespaces from the message, just one of the namespace declarations and if so, there wouldn't be any of that namespace in the message itself.

What would probably work is this field type:
Code:
(XMLNSC.NamespaceDecl)
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Wed Jun 06, 2007 10:45 am    Post subject: Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

special_agent_Queue wrote:
I don't think nobody wants to remove namespaces from the message, just one of the namespace declarations and if so, there wouldn't be any of that namespace in the message itself.

What would probably work is this field type:
Code:
(XMLNSC.NamespaceDecl)



UPS sorry...
You are right.

I wrote it to fast
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
kimbert
PostPosted: Wed Jun 06, 2007 3:20 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
it is not really a field but an attribute is it not
Well, in the message broker tree everything is a syntax element. A namespace declaration is just a syntax element with name=prefix, value=URI and a special type value to mark it as a namespace declaration.

As special_agent_Queue says, something like this should do the trick:

Code:
SET OutputRoot.XMLNSC.(XMLNSC.NamespaceDecl)prefix = NULL;
Back to top
View user's profile Send private message
nobody
PostPosted: Wed Jun 06, 2007 11:49 pm    Post subject: Reply with quote

Newbie

Joined: 06 Jun 2007
Posts: 3

Gents / Ladies

Thanx for the reply I have since manage to get a decent trace and found the following, the "wotever it is" is ahas a field type of 0x03000102 which i have tried to lookup in the manuals and have found pretty much everything except this although the values in did find were only for the MRM and XML Parser conbstants not the XMLNSC (assume that this would be a seperate catagory and not bundled under XML) so maybe i can use that in a move against type scenario??

Here tis the trace output

0x01000000):XMLNSC = (
(0x01000000)http://www.w3.org/2000/xmlns/:TradesmanAllNBRq = (
(0x03000102):TradesmanAllNBRq = 'http://www.polaris-uk.co.uk/Schema/1-4/NUPrivateTradesmanAllNBRq'
(0x03000102):qs = 'http://www.aviva.com/NUI/2005/05/QuoteStore'
(0x03000000):DateGenerated = '2005-05-20'
(0x03000000):TimeGenerated = '10:00:00'
(0x03000000):StartDate = '2005-05-20'

the bit i want rid of is the (0x03000102):qs = 'http://www.aviva.com/NUI/2005/05/QuoteStore' piece

Appreciate all your input. Thanks
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Jun 07, 2007 12:06 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
i have tried to lookup in the manuals and have found pretty much everything except this
Have you seen this topic?
http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r0m0/topic/com.ibm.etools.mft.doc/ac26040_.htm

I found it by searching for NamespaceDecl
Back to top
View user's profile Send private message
nobody
PostPosted: Thu Jun 07, 2007 1:06 am    Post subject: Reply with quote

Newbie

Joined: 06 Jun 2007
Posts: 3

kimbert:

Yeah thanks, have to admit to small typo mistake on my behalf as didn't know if it was a Namesapcedecl so didn't search that i searched on the 0x3xxxx number but had typed it as 300012 not 3000102. Sorry peeps.
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 » Namespace manipulation in XMLNSC parser
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.