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 » Converting malformed XML string to well-formed xml object

Post new topic  Reply to topic
 Converting malformed XML string to well-formed xml object « View previous topic :: View next topic » 
Author Message
MBLearner
PostPosted: Fri Feb 03, 2006 7:35 am    Post subject: Converting malformed XML string to well-formed xml object Reply with quote

Novice

Joined: 20 Jan 2006
Posts: 23

I have a xml string which has multiple root tag elements as mentioned below:

<BusinessObject>DEBMAS06_ZDEBMAS</BusinessObject>
<Verb>Create</Verb>
<ControlRecord>
<CRField>TABNAM=EDI_DC40</CRField>
..
..
<CRField>CRETIM=231131</CRField>
</ControlRecord>
<DataRecord>
..
..
</DataRecord>
<EndBO>DEBMAS06_ZDEBMAS</EndBO>

As the structure specified, it has multiple root tag ie <BusinessObject>, <Verb>, <ControlRecord>, <DataRecord> and <EndBO>. So This cannot be converted to XML object as the string doesn't have a single root tag element. So I tried to wrap the string within a single XML tag (say, SAPErrorQueueMessage) as follows:

Code:
SET OutputRoot.XML.(XML.Element)SAPErrorQueueMessage.(XML.BitStream) = InputRoot."BLOB"."BLOB";


and then passing the value to two successive ResetContentDescriptor nodes so that it first gets transformed into BLOB Domain and then again XML domain. But it is still not forming the xml object so that I can parse like

InputBody.(XML.Element)[1].verb

Do any of you have any solution of how to do it. Thanks in advance.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Feb 03, 2006 7:43 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Technically, it can't be an XML string if it has more than one root tag.

I would read the message as a BLOB, concat the raw text "<SAPErrorQueueMessage>" to the front, and the raw text "</SAPErrorQueueMessage>" to the back.

If you've got XML declarations in the string, you might need to use do stuff to insert the opening tag after the declarations but before your first data tag.

Then run it through one RCD to parse the XML.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
JT
PostPosted: Fri Feb 03, 2006 8:08 am    Post subject: Reply with quote

Padawan

Joined: 27 Mar 2003
Posts: 1564
Location: Hartford, CT.

This will produce the results I believe, you're looking for:

Code:
SET OutputRoot.XML.(XML.Element)SAPErrorQueueMessage.(XML.AsisElementContent) = CAST(InputRoot."BLOB"."BLOB" AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId);
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 » Converting malformed XML string to well-formed xml object
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.