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 » XML tag declaration

Post new topic  Reply to topic
 XML tag declaration « View previous topic :: View next topic » 
Author Message
rinky_chand
PostPosted: Fri Apr 27, 2012 3:59 am    Post subject: XML tag declaration Reply with quote

Newbie

Joined: 16 Apr 2012
Posts: 5

I am facing a problem in creating XML tags
below I have provided my code...

WHILE CARDINALITY(InputRoot.Collection.Input1.MRM.type1[])>= J DO
WHILE CARDINALITY(InputRoot.Collection.Input2.MRM.Body[])>= I DO
IF InputRoot.Collection.Input1.MRM.type1[J].Property = SUBSTRING(InputRoot.Collection.Input2.MRM.Body[I].Concept AFTER ':')
THEN
SET MainTag = InputRoot.Collection.Input2.MRM.Body[I].Concept;
IF SUBSTRING(FIELDNAME(InputRoot.Collection.Input1.MRM.type1.Y2007)AFTER 'Y') = SUBSTRING(InputRoot.Collection.Input2.MRM.Body[I].Context AFTER '-')
THEN
CREATE LASTCHILD OF OutputRoot.XMLNSC.XBRL Name MainTag;
SET OutputRoot.XMLNSC.XBRL.{MainTag} = InputRoot.Collection.Input1.MRM.type1[J].Y2007;
SET OutputRoot.XMLNSC.XBRL.{MainTag}.(XMLNSC.Attribute)contextRef = InputRoot.Collection.Input2.MRM.Body[I].Context;
SET OutputRoot.XMLNSC.XBRL.{MainTag}.(XMLNSC.Attribute)unitRef =InputRoot.Collection.Input2.MRM.Body[I].Unit;
SET OutputRoot.XMLNSC.XBRL.{MainTag}.(XMLNSC.Attribute)decimals =InputRoot.Collection.Input2.MRM.Body[I].Decimal;

--
ELSE
CREATE LASTCHILD OF OutputRoot.XMLNSC.XBRL Name MainTag;
SET OutputRoot.XMLNSC.XBRL.{MainTag} = InputRoot.Collection.Input1.MRM.type1[J].Y2006;
SET OutputRoot.XMLNSC.XBRL.{MainTag}.(XMLNSC.Attribute)contextRef = InputRoot.Collection.Input2.MRM.Body[I].Context;
SET OutputRoot.XMLNSC.XBRL.{MainTag}.(XMLNSC.Attribute)unitRef =InputRoot.Collection.Input2.MRM.Body[I].Unit;
SET OutputRoot.XMLNSC.XBRL.{MainTag}.(XMLNSC.Attribute)decimals =InputRoot.Collection.Input2.MRM.Body[I].Decimal;

-- SET OutputRoot.XMLNSC.XBRL.{MainTag} = InputRoot.Collection.Input1.MRM.type1.Y2006;
END IF;
SET I = I+ 1;
SET loopterminater=loopterminater+1;
IF loopterminater=2 THEN
SET I =CARDINALITY(InputRoot.Collection.Input2.MRM.Body[])+1;
SET loopterminater = 0;
END IF;
ELSE
SET I = I + 1;
END IF;
END WHILE;
SET J = J + 1;
SET I = 1;
END WHILE;


My result should be like this

<HelloWorld:Land contextRef="I-2007" unitRef="U-Monetary" decimals="INF">5347000</HelloWorld:Land>
<HelloWorld:Land contextRef="I-2006" unitRef="U-Monetary" decimals="INF">1147000</HelloWorld:Land>
<HelloWorld:BuildingsNet contextRef="I-2007" unitRef="U-Monetary" decimals="INF">244508000</HelloWorld:BuildingsNet>
<HelloWorld:BuildingsNet contextRef="I-2006" unitRef="U-Monetary" decimals="INF">366375000</HelloWorld:BuildingsNet>


But I am getting this..

<?xml version="1.0" encoding="UTF-8" standalone="yes"?><XBRL><HelloWorld:Land contextRef="I-2006" unitRef="U-Monetary" decimals="INF">1147</HelloWorld:Land><HelloWorld:Land/><HelloWorld:BuildingsNet contextRef="I-2006" unitRef="U-Monetary" decimals="INF">366375</HelloWorld:BuildingsNet><HelloWorld:BuildingsNet/>

I want two tags with same names but different values, my code is creating two tags but the first tags values are getting override in second one.
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Apr 27, 2012 5:26 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You should:
- use [c o d e] tags when you post source code or XML. Reading what you posted makes my eyes hurt.
- when building the output tree, use a REFERENCE variable that points at the specific tag that you want to modify. The SET OutputRoot.x.y technique will apply your changes to the first match that it finds ( as you have discovered ).

Someone will be along shortly to tell you not to use CARDINALITY because it's bad for performance. Which is true in cases where the returned value is large. It's certainly true that REFERENCE variables can reduce CPU usage, and you will not need CARDINALITY if you use REFERENCEs.

I haven't analysed your ESQL in detail, but I *suspect* ( I will not put it any more strongly than that ) that you could replace those loops with one or two SELECT statements.
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 » XML tag 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.