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 » FIELDTYPE function question

Post new topic  Reply to topic
 FIELDTYPE function question « View previous topic :: View next topic » 
Author Message
gfrench
PostPosted: Wed Aug 11, 2010 11:20 pm    Post subject: FIELDTYPE function question Reply with quote

Acolyte

Joined: 10 Feb 2002
Posts: 71

I need to write a little procedure to strip namespace declarations, attributes out of some XML before passing it as clob for database (don't ask why, just started on this project!)

I've copied the sample recursive procedure and reworked it as follows

CREATE PROCEDURE navigate (IN inRef REFERENCE,IN outRef REFERENCE)
BEGIN
DECLARE tmpChar CHAR;
DECLARE cursor REFERENCE TO inRef;
MOVE cursor FIRSTCHILD TYPE Name;

IF LASTMOVE(cursor) THEN
CREATE LASTCHILD OF outRef AS outRef NAME FIELDNAME(cursor) VALUE cursor;
END IF;

WHILE LASTMOVE(cursor) DO
CALL navigate(cursor, outRef);
MOVE cursor NEXTSIBLING TYPE Name;
IF LASTMOVE(cursor) THEN
CREATE NEXTSIBLING OF outRef AS outRef NAME FIELDNAME(cursor) VALUE cursor;
END IF;
END WHILE;
END;

but the TYPE Name is not working. I've tried TYPE XMLNSC.Folder adn XMLNSC.Field and various others, and in the end changed it to:-

CREATE PROCEDURE navigate (IN inRef REFERENCE,IN outRef REFERENCE)
BEGIN
DECLARE tmpChar CHAR;
DECLARE cursor REFERENCE TO inRef;
MOVE cursor FIRSTCHILD;

IF LASTMOVE(cursor) AND (FIELDTYPE(cursor) IN (0x01000000, 0x03000000)) THEN
CREATE LASTCHILD OF outRef AS outRef NAME FIELDNAME(cursor) VALUE cursor;
END IF;

WHILE LASTMOVE(cursor) DO
CALL navigate(cursor, outRef);
MOVE cursor NEXTSIBLING;
IF LASTMOVE(cursor) AND (FIELDTYPE(cursor) IN (0x01000000, 0x03000000)) THEN
CREATE NEXTSIBLING OF outRef AS outRef NAME FIELDNAME(cursor) VALUE cursor;
END IF;
END WHILE;
END;

Obviously I prefer not to use the hex stuff. Anyone got any simpel suggetsions. I've exhausted google searches, manual etc and it looks like most other people gave up to!

Cheers for any help

Graham
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mqjeff
PostPosted: Thu Aug 12, 2010 1:57 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I would instead check that you have found an XMLNSC.NamespaceDecl item and NOT copy it, in that case.

Type NAME is not a sufficient filter, nor is checking for those hex values checking for the things you think it is.
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Aug 12, 2010 5:00 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I'm not sure that I understand what you are trying to do. Are you
a) stripping out all namespace info from the message tree
or
b) just deleting the namespace declarations ( xmlns attributes )
or
c) something else

if a), you need to be aware that the resulting output XML will still contain namespace prefixes - they will be automatically assigned by the XMLNSC writer. If you want to remove namespace info completely, you need to explicitly set the namespace to the empty string on each and every node in OutputRoot.XMLNSC.
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 » FIELDTYPE function question
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.