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 » Capturing part of a XML as Char to store in database

Post new topic  Reply to topic
 Capturing part of a XML as Char to store in database « View previous topic :: View next topic » 
Author Message
Frnd
PostPosted: Fri Aug 05, 2011 12:14 am    Post subject: Capturing part of a XML as Char to store in database Reply with quote

Apprentice

Joined: 04 Jun 2007
Posts: 33

Hi All
i have the following requirement - Part of an incoming XML message should be inserted to database as a single column i.e, message_body. My flow has MQInput , Compute and a Error handling sub flow. Domain of MQInput used is XMLNSC. I need to store the part of the incoming XML message in a single CHAR variable so as to insert into DB. I have tried the below


SET Msgpart = ASBITSTREAM(InputRoot.XMLNSC.Msgpart[<},1208,FolderBitStream);
SET OutputRoot.Msgpart_dbupdate = CAST(Msgpart as char CCSID InputRoot.Properties.CodedCharSetId Encoding InputRoot.Properties.Encoding);

I am getting error saying that no root element found.

The input XML is of the below format
<Header>

</Header>
<MessageBody>
<A>
<ABC>F001</ABC>
<XYZ>
<XYZ1>123</XYZ1>
<XYZ2>2456></XYZ2>
</XYZ>
<DEF>
<DEF1></DEF1>

<DEF2></DEF2>
</DEF>
</A>
</MessageBody>

i am trying to capture contents of XYZ alone...Can someone pls help?
Back to top
View user's profile Send private message
exerk
PostPosted: Fri Aug 05, 2011 12:26 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

Moving this to the Broker forum...

Frnd, please take note of where you post. If you're not sure, add a comment within the post asking a moderator to move it if appropriate. Thank you.
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
WGerstma
PostPosted: Fri Aug 05, 2011 1:50 am    Post subject: Reply with quote

Acolyte

Joined: 18 Jul 2011
Posts: 55

See

http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac67175_.htm

for the usage of ASBITSTREAM and the OPTION keyword.
Back to top
View user's profile Send private message
Frnd
PostPosted: Fri Aug 05, 2011 3:26 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2007
Posts: 33

Sure exerk.will take care of it gng fwd.

hi wgerstma,

Went through the link.Thanks for sharing.So does that mean that we cannot get the content of the XYZ unless we have a root element there ?
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Aug 05, 2011 4:08 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
does that mean that we cannot get the content of the XYZ unless we have a root element there ?
Please explain what you mean in more detail. Do you have multiple document roots that you want to serialize into a single document?
Back to top
View user's profile Send private message
Frnd
PostPosted: Fri Aug 05, 2011 4:18 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2007
Posts: 33

I am looking for getting the content of XYZ into a variable.But since XYZ doesn't have a single root element, I am getting error that " No root element found"
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Aug 05, 2011 4:23 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Why does it matter if the the root tag 'XYZ' is included at the start and end? If you don't store the root tag then the content of the DB table will be a malformed XML document ( which is why XMLNSC refuses to write it ).

If you *really* don't want the <XYZ> at the start/end then use SUBSTRING to remove it before inserting into the DB.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Fri Aug 05, 2011 4:35 am    Post subject: Re: Capturing part of a XML as Char to store in database Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

If this is truly the entire "XML" message you are working with...

Frnd wrote:

The input XML is of the below format
<Header>

</Header>
<MessageBody>
<A>
<ABC>F001</ABC>
<XYZ>
<XYZ1>123</XYZ1>
<XYZ2>2456></XYZ2>
</XYZ>
<DEF>
<DEF1></DEF1>

<DEF2></DEF2>
</DEF>
</A>
</MessageBody>


Then it is working as designed if you are getting this error as that is not valid XML. The XML tools within the broker will only work with valid XML documents.

Frnd wrote:
I am getting error saying that no root element found.


Your "XML" has two root elements, Header and MessageBody so therefore it is not valid.

Fix the XML and then you can use the XML tooling within the broker otherwise you will need to do string manipulation to get at your data.
Back to top
View user's profile Send private message
joebuckeye
PostPosted: Fri Aug 05, 2011 4:37 am    Post subject: Reply with quote

Partisan

Joined: 24 Aug 2007
Posts: 365
Location: Columbus, OH

Not to mention that this:

Code:
InputRoot.XMLNSC.Msgpart[<]


does not refer to anything within the "XML" structure you posted.
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 » Capturing part of a XML as Char to store in database
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.