|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Converting malformed XML string to well-formed xml object |
« View previous topic :: View next topic » |
Author |
Message
|
MBLearner |
Posted: Fri Feb 03, 2006 7:35 am Post subject: Converting malformed XML string to well-formed xml object |
|
|
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 |
|
 |
jefflowrey |
Posted: Fri Feb 03, 2006 7:43 am Post subject: |
|
|
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 |
|
 |
JT |
Posted: Fri Feb 03, 2006 8:08 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|