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 » I failed to create following XML Structure,Help Me to resolv

Post new topic  Reply to topic
 I failed to create following XML Structure,Help Me to resolv « View previous topic :: View next topic » 
Author Message
mahesh2069
PostPosted: Fri Oct 25, 2013 2:42 am    Post subject: I failed to create following XML Structure,Help Me to resolv Reply with quote

Centurion

Joined: 26 Jun 2013
Posts: 103

Hi All,

I wanna create XML Structure like bellow.

Code:


<root>
<attr>xxx</attr>
<attr>xxx</attr>
<attr_Many>xxxx</attr_Many>
<attr>xxxx</attr>
</root>


For that I had written following code.



Code:


               SET OutputRoot.XMLNSC.root.attr[1]='xxx';
      SET OutputRoot.XMLNSC.root.attr[2]='xxx';
      SET OutputRoot.XMLNSC.root.attrMany='xxxx';
      SET OutputRoot.XMLNSC.root.attr[3]='xxx';



But I failed to create out XML structure as above mentioned.

I got

Code:

<root>
<attr>xxx</attr>
<attr>xxx</attr>
<attr>xxxx</attr>
<attr_Many>xxxx</attr_Many>
</root>


But I need 3rd 'attr' element after 'attr_Many' element. Help me how to resolve the issue.
_________________
Thanks & Regards
Mahesh Mediboyina
WMB Developer
Back to top
View user's profile Send private message
Simbu
PostPosted: Fri Oct 25, 2013 3:07 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

CREATE LASTCHILD OF
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Oct 25, 2013 4:58 am    Post subject: Reply with quote

Grand High Poobah

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

Code:
SET OutputRoot.XMLNSC.root.attr[1]='xxx';
is just plain wrong.
Should be something like
Code:
SET OutputRoot.XMLNSC.root.(XMLNSC.Attribute)attr[1]='xxx';

Now go read the infocenter and find out why: see also specific types.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
dogorsy
PostPosted: Fri Oct 25, 2013 5:57 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

fjb_saper wrote:
Code:
SET OutputRoot.XMLNSC.root.attr[1]='xxx';
is just plain wrong.
Should be something like
Code:
SET OutputRoot.XMLNSC.root.(XMLNSC.Attribute)attr[1]='xxx';

Now go read the infocenter and find out why: see also specific types.


Not really !!... The op was not creating a XMLNSC.Attribute, was creating a nameValue field, it just happened to be named attr.
See the message example the OP added in the first post.
what you suggested would create:
Code:
<root attr='xxx' attr='yyy' etc/>

which is not the same.

Simbu's answer is the correct one.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Oct 25, 2013 7:12 am    Post subject: Reply with quote

Grand High Poobah

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

Should have taken more time reading the post...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
dogorsy
PostPosted: Fri Oct 25, 2013 7:21 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

fjb_saper wrote:
Should have taken more time reading the post...


No problem. However, I do agree the OP should read the infocenter..
Back to top
View user's profile Send private message
mahesh2069
PostPosted: Fri Oct 25, 2013 12:36 pm    Post subject: Please reslove this issue, atrribute and Vlaue of Element Reply with quote

Centurion

Joined: 26 Jun 2013
Posts: 103

Hi All,

I need to construct a Structure like

Code:


<items>
  <item>
       <attr name="baseRetailUomCd">GR</attr>
       <attr name="mfgrSugdRtlAmt"></attr>
        <attrMany name="spclHndlgMsg">
            <value> </value>
       </attrMany>
       <attr name="vendorDeptNbr">1</attr>
       <attr name="consumerItemNbr">8960562</attr>
  </item>
</items>




For that I wrote code like this


Code:



      SET OutputRoot.XMLNSC.items.item.attr[1].(XMLNSC.Attribute)name='baseRetailUomCd';
      SET OutputRoot.XMLNSC.items.item.attr[1]='GR';
      
      SET OutputRoot.XMLNSC.items.item.attr[2].(XMLNSC.Attribute)name='mfgrSugdRtlAmt';
      SET OutputRoot.XMLNSC.items.item.attrMany.(XMLNSC.Attribute)name='spclHndlgMsg';
      
      SET OutputRoot.XMLNSC.items.item.attr.(XMLNSC.Attribute)name = 'baseRetailUomCd';

   --   CREATE  LAST CHILD OF OutputRoot.XMLNSC.items.item NAME 'attr' VALUE 'GR';
/*
WITH HELP OF WE CAN CREATE EITHER ATTRIBUTE OR VALUE OF ELEMENT.. BUT I NEED BOTH
*/      
      
      SET OutputRoot.XMLNSC.items.item.attr[3].(XMLNSC.Attribute)name='vendorDeptNbr';
      SET OutputRoot.XMLNSC.items.item.attr[3]='1';

/*

ABOVE STATEMENT NOT CREATE NEXT SIBLING 'attrMany ' ,IT GOES ON TOP OF 'attrMany ' , STRUCTURE WILL DIFFER FROM GIVEN

*/






PLZ HELP ME RESOLVE THIS ISSUE
_________________
Thanks & Regards
Mahesh Mediboyina
WMB Developer
Back to top
View user's profile Send private message
dogorsy
PostPosted: Fri Oct 25, 2013 12:42 pm    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

As Simbu said, use CREATE LASTCHILD

Look at the syntax in the infocenter. the reason it is not working is because you have not specified all the parameters you need.
DO NOT EXPECT people to write it for you. You do your homework and try it out.
So, you said you can create either, but not both. What is preventing you from coding TWO create statements ?!


Last edited by dogorsy on Fri Oct 25, 2013 12:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Oct 25, 2013 12:43 pm    Post subject: Reply with quote

Grand High Poobah

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

You've gotten multiple pointers. You now need to play around with your code and view the results. I'm sure that within a few iterations you'll get the right stuff.

Remember
Code:
CREATE [Last Child | previous sibling | next sibling ] etc... 

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mgk
PostPosted: Fri Oct 25, 2013 2:40 pm    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

What you are missing is that when you try to create item.attr[3] ESQL will count from item[1] to find attr[2] and always create attr[3] immediately after attr[2]. So to create the structure want you need to use CREATE LASTCHILD for all "attr" children after "attrMany". So you could just use CREATE LASTCHILD for all elements in this structure... Alternatively, if you only have one instance of "attrMany" you could create all the "attr" elements first and then use a REFERENCE to insert "attrMany" afterwards. Bear in mind that if you have a lot of "attr" elements, using a REFERENCE rather than indexing with [] will perform better.

Kind regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
dogorsy
PostPosted: Sat Oct 26, 2013 4:29 am    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

and, the description of the problem has also changed.
Does that mean that once you get an answer to a problem, you move on to the next thing you don't know and that way you get free training ?
Back to top
View user's profile Send private message
mgk
PostPosted: Sat Oct 26, 2013 6:46 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

Quote:
and, the description of the problem has also changed.


I disagree. If you look carefully, you'll see it is the same problem restated but with more information. Something I actually approve of

Kind regards,
_________________
MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Back to top
View user's profile Send private message
dogorsy
PostPosted: Sat Oct 26, 2013 3:35 pm    Post subject: Reply with quote

Knight

Joined: 13 Mar 2013
Posts: 553
Location: Home Office

In the first post the OP wanted to generate
Code:
<root>
 <attr>xxx</attr>
 <attr>xxx</attr>
 <attr_Many>xxxx</attr_Many>
 <attr>xxxx</attr>
 </root>
and he was told how,
then he said he wanted to generate
Code:
<items>
  <item>
       <attr name="baseRetailUomCd">GR</attr>
       <attr name="mfgrSugdRtlAmt"></attr>
        <attrMany name="spclHndlgMsg">
            <value> </value>
       </attrMany>
       <attr name="vendorDeptNbr">1</attr>
       <attr name="consumerItemNbr">8960562</attr>
  </item>
</items>

If it was the same problem, it would have the same solution. So no point in asking again.

The first problem was that the OP did no know how to create the 3rd subscript of the element attr after the element attrMany.
The new problem is that he does not know how to CREATE an element with a value and an attribute.
To me, that is 2 problems.
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 » I failed to create following XML Structure,Help Me to resolv
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.