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 » Removing repeating NULL xml tags

Post new topic  Reply to topic
 Removing repeating NULL xml tags « View previous topic :: View next topic » 
Author Message
dschott
PostPosted: Thu Feb 13, 2003 8:27 am    Post subject: Removing repeating NULL xml tags Reply with quote

Newbie

Joined: 06 Sep 2002
Posts: 2

I am creating an XML message from a MRM message set. The MRM has an array for the F520Z_METER_DATA_AREA section which occurs 25 times. Within this array, there is a section called F520Z_READING_DATA_AREA which occurs 14 times. The person receiving this XML does not want to receive the repeating NULL F520Z_READING_DATA_AREA tags, since it adds around 10k to the message size.

In my compute node, I have tried: not outputting the tags, using DETACH, even tried sending the output to another compute node to strip out the tags, but each time I try, I get an "array subscript error" message. Has anyone else run into this before? Thanks!

Here is the ESQL that creates the XML:

DECLARE C INT;
DECLARE D INT;
SET C = 25;
SET D = 1;
WHILE D <= C DO
IF "InputBody"."F520Z_METER_DATA_AREA"[D]."F520Z_METER_DATA_RETURN"."F520Z_METR_ERROR_CD" <> 0 THEN
SET OutputRoot.XML.SPECTRUM.DATA.F520Z_METER_DATA_AREA[D].F520Z_MFR_CD = "InputBody"."F520Z_METER_DATA_AREA"[D]."F520Z_MFR_CD";
SET OutputRoot.XML.SPECTRUM.DATA.F520Z_METER_DATA_AREA[D].F520Z_METR_ERROR_CD = "InputBody"."F520Z_METER_DATA_AREA"[D]."F520Z_METER_DATA_RETURN"."F520Z_METR_ERROR_CD";
ELSE
SET OutputRoot.XML.SPECTRUM.DATA.F520Z_METER_DATA_AREA[D].F520Z_METR_ERROR_CD = NULL;
END IF;

DECLARE E INT;
DECLARE F INT;
SET E = 14;
SET F = 1;
WHILE F <= E DO
IF "InputBody"."F520Z_METER_DATA_AREA"[D]."F520Z_READING_DATA_AREA"[F]."F520Z_READING_DATA_RETURN"."F520Z_RDG_ERROR_CD" <> 0 THEN
SET OutputRoot.XML.SPECTRUM.DATA.F520Z_METER_DATA_AREA[D].F520Z_READING_DATA_AREA[F].F520Z_DEVC_RGST_ID =
"InputBody"."F520Z_METER_DATA_AREA"[D]."F520Z_READING_DATA_AREA"[F]."F520Z_DEVC_RGST_ID";
SET OutputRoot.XML.SPECTRUM.DATA.F520Z_METER_DATA_AREA[D].F520Z_READING_DATA_AREA[F].F520Z_RDG_ERROR_CD =
"InputBody"."F520Z_METER_DATA_AREA"[D]."F520Z_READING_DATA_AREA"[F]."F520Z_READING_DATA_RETURN"."F520Z_RDG_ERROR_CD";
SET F = F + 1;
ELSE
SET OutputRoot.XML.SPECTRUM.DATA.F520Z_METER_DATA_AREA[D].F520Z_READING_DATA_AREA[F].F520Z_RDG_ERROR_CD = NULL;
SET F = F + 1;
END IF;
END WHILE;

SET D = D + 1;
END WHILE;


Here is the output:

<SPECTRUM>
<DATA>
<F520Z_METER_DATA_AREA>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA>
<F520Z_DEVC_RGST_ID>2</F520Z_DEVC_RGST_ID>
<F520Z_RDG_ERROR_CD>15</F520Z_RDG_ERROR_CD>
</F520Z_READING_DATA_AREA>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
</F520Z_METER_DATA_AREA>
<F520Z_METER_DATA_AREA>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
<F520Z_READING_DATA_AREA/>
....and so on...
</DATA>
</SPECTRUM>
Back to top
View user's profile Send private message
jfluitsm
PostPosted: Fri Feb 14, 2003 1:20 am    Post subject: Reply with quote

Disciple

Joined: 24 Feb 2002
Posts: 160
Location: The Netherlands

Hello,

I assume that you are building the output message and didn't copy the complete inputbody first.

First I think you should leave out the ELSE .. part as you are deleting non-existing fields, take also a lok aat SET F = F + 1, this should be ater the END IF;

Your subscript error is generated because there are 'holes' in it at the output side.
Say you want to copy elemets 1 and 3
With D=1 the first element is copied
With D=2 you delete the second (non existing) element from the output, I am not sure wether this will generate an error or not.
with D=3 you want to fill element 3 in the output, but there is no element 2, this will generate your error.

Depending on the version and CSD you are using you can either use a separate index for the output or make use of reference fields, create statament (lastchild or nextsibling) and the for statement
_________________
Jan Fluitsma

IBM Certified Solution Designer WebSphere MQ V6
IBM Certified Solution Developer WebSphere Message Broker V6
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 » Removing repeating NULL xml tags
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.