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 » Handling Invalid XML

Post new topic  Reply to topic
 Handling Invalid XML « View previous topic :: View next topic » 
Author Message
neo_revolution
PostPosted: Thu Apr 15, 2004 4:42 am    Post subject: Handling Invalid XML Reply with quote

Voyager

Joined: 21 Oct 2003
Posts: 80
Location: NJ

Hi All,

I am trying to handle Invalid XML coming to the MQInputNode. If the XML is not well formed it is going to the catch terminal of the InputNode.

There I have a compute node where I create XML and I would like to include request in the XML I am creating. As the XML is invalid I can't attach to a child in the newly created XML.

What I wish to do is take the entire xml 'InputRoot.XML' and attach it to a XML element with CDataSection using ESQL. Something like this

SET Error.value.(XML.CDataSection) = InputRoot.XML;

But this is not working. Is there a way to take the invalid xml and attach it to a xml tag...

Thanks in advance.
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Thu Apr 15, 2004 4:49 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Even CDATA sections have to match certain requirements in order to be valid and "parseable" by the parser.

You could do something like replace all of the <, >, and etc (per the XML standard for CDATA sections) with the entity representation (&lt; for example).

Or you could cast the bad XML data to a BLOB field, and then put this into the CData section. That will give you a hex character representation of the bitstream. (X'0FA422' for example).
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
neo_revolution
PostPosted: Thu Apr 15, 2004 4:55 am    Post subject: Reply with quote

Voyager

Joined: 21 Oct 2003
Posts: 80
Location: NJ

jeff,

can't I cast XML into something String or Char? because I would like to have the XML representation instead of Bitstream.
Back to top
View user's profile Send private message Yahoo Messenger
jefflowrey
PostPosted: Thu Apr 15, 2004 5:01 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes, if you replace the needed characters with entities or something, so that the contents of the CDATA section meet the standards for CDATA content.

On the other hand, XML should only be read and seen by machines and not by people, in my opinion. So designing XML to be human readable is a waste of time. It should be meaningful to people to describe the data, but that's not the same thing as readable to people.

But that's just my opinion.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
wendy
PostPosted: Thu Apr 15, 2004 5:25 am    Post subject: Reply with quote

Apprentice

Joined: 10 Dec 2001
Posts: 47

Try this :

Set OutputRoot.XML.Element1 =
CAST(BITSTREAM(InputRoot.MRM) AS CHAR CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding);


I'm assuming that the inputnode has a Message Set defined(based on an XSD)
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Thu Apr 15, 2004 5:29 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Wendy -
That code will indeed assign the contents of an entire XML tree into the contents of a single XML field.

But if the XML is not parseable because, for instance, it has mismatched >'s, then the resulting XML field will not be valid.

Even IF the XML field is set up as a CDATA section (which your code doesn't do). There are some parser errors that can be encapsulated this way, and some that can't.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
neo_revolution
PostPosted: Thu Apr 15, 2004 6:15 am    Post subject: Reply with quote

Voyager

Joined: 21 Oct 2003
Posts: 80
Location: NJ

yeah I understand... But there are some fields based on which the request and response are correlated. And the process is a manual activity. So need to do this way.
Back to top
View user's profile Send private message Yahoo Messenger
neo_revolution
PostPosted: Thu Apr 15, 2004 7:38 am    Post subject: Reply with quote

Voyager

Joined: 21 Oct 2003
Posts: 80
Location: NJ

Thanks Wendy,

It worked for me this way ....

Set OutputRoot.XML.Element1.(XML.CDataSection) =
CAST(ASBITSTREAM(InputRoot.XML OPTIONS FolderBitStream) AS CHAR CCSID InputRoot.MQMD.CodedCharSetId ENCODING InputRoot.MQMD.Encoding);


Thanks a lot guys.
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Handling Invalid XML
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.