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 » How to check message is XML well-formatted ?

Post new topic  Reply to topic
 How to check message is XML well-formatted ? « View previous topic :: View next topic » 
Author Message
Bell Hung
PostPosted: Thu Apr 18, 2002 10:16 pm    Post subject: Reply with quote

Newbie

Joined: 05 Dec 2001
Posts: 5
Location: Taiwan

Hello all :
My situation is when the message is not well-formatted , it will caused my system resource shortage.So I need one method to check if the message is standard XML well-formatted message or not , if not , I will copy header only and construct an well-formatted XML message and go to other message flow to process.
I found the XML paser only paser the tag that I'm just dealing with , not whole message tree , so it can't found other error in whole message tree. like tag not match for other tag , duplicate root tree and so on. Can I have a better method to check if the whole message is XML well-formatted message or not ?
Now what I can do is add a compute node to check each tag that I think I should have to force XML paser to check these tag for me and check root tree is array or not to solve this problem , but it seem very stupid , does anyony have a better way to solve such a problem ??
Thanks a lot !!
Back to top
View user's profile Send private message MSN Messenger
kwelch
PostPosted: Fri Apr 19, 2002 4:48 am    Post subject: Reply with quote

Master

Joined: 16 May 2001
Posts: 255

What version of WMQI are you running? I think with 2.1 you can import a DTD and validate your XML message. I haven't tried it yet though.

Karen
Back to top
View user's profile Send private message Send e-mail
kirani
PostPosted: Fri Apr 19, 2002 8:36 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Bell,

Regardless of MQSI version that you are using, XML parser should work in the same way. i.e. If the XML message is not well-formatted you will get parsing error immediately. You need not check for all tags in the message. If you want to validate your message you should use DTD to validate the message. As karen said, this feature is only available in ver 2.1.

MQSI uses just-in-time parsing. This means MQSI will parse the complete message after you refer to any element for the first time. So in your message flow you just check for one element and it will invoke the parser. If your message is not wellformed, it will throw an error. You can write an ESQL in a Filter node,

Root.XML.OuterTag IS NOT NULL

True terminal of Filter node will process your message, It will tell you the messaeg is wellformed XML message.
In the False terminal you can build your message body and do further processing.

Hope this helps!


_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Bell Hung
PostPosted: Thu Apr 25, 2002 2:33 pm    Post subject: Reply with quote

Newbie

Joined: 05 Dec 2001
Posts: 5
Location: Taiwan

Hi Kiran :

I've use your method to help to check XML format is well-format or not.
In moust of case , it will help us succesful parsing XML tag.
But I found , when I put a message only have

<?xml version="1.0" encoding = "Big5" ?>

Then DataFlowEngine will cause CPU usage up to 90%.
Do you have any idea to handle such XML data ?
And do you know what's wrong with XML Paser to handle this message ?

Thanks help !!
Back to top
View user's profile Send private message MSN Messenger
kirani
PostPosted: Fri Apr 26, 2002 7:58 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Bell,
Above message is not wellfoemed XML message. The body of the XML message is missing here. You should have atleast one top level tag in a XML message. I don't know the reason why your CPU usage goes upto 90%.


_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
psk
PostPosted: Fri Apr 26, 2002 9:04 am    Post subject: Reply with quote

Novice

Joined: 24 Apr 2002
Posts: 14

Hi , sorry to interupt.. I wanted to understand the exact situation in which the CPU usage be very high. Whenever the not well formed XML message is passed thr the message flow, does the CPU usage increases dramatically??? What would be the basic solution for this..? And also how would DTD solve this problem..
Thanks
Back to top
View user's profile Send private message
Miriam Kaestner
PostPosted: Sat Apr 27, 2002 11:19 am    Post subject: Reply with quote

Centurion

Joined: 26 Jun 2001
Posts: 103
Location: IBM IT Education Services, Germany

I could recreate the problem with a message such as
<?xml version="1.0" encoding = "Big5" ?>
I think this is a bug that should be reported.

On the other hand, using the Filter node to check for well-formatted XML will not work in all cases. If you have a message such as
<A><B>1</B></A><anotherRoot>2</anotherRoot>
and a Filter node with ESQL like
Root.XML.A IS NOT NULL
this will yield TRUE, even though the message is not well-formed. The reason is, that the broker uses lazy-parsing. It parses just as much as it has to in the moment. So it will not detect the wrong XML after it has successfully found tag A.

So, if you want to check the entire incoming message for well-formed XML, you must force the broker to parse the entire message body. This could be done with a Trace node, with trace destination=none and trace pattern
${Root}
Then you must do exception processing in the CATCH path of MQInput node.
MQInput -out> Trace -out> normalProcessing
-catch> inspect ExceptionList and build new body
Back to top
View user's profile Send private message Send e-mail
kirani
PostPosted: Tue Apr 30, 2002 9:03 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Using filter node logic to check well-formed XML message will ONLY work in MQSI 2.0.x. The reason you can get away with non-wellformed messages in WMQI 2.1 is because of partial parsing. It is always better to use Empty trace node to parse complete message as suggested by Miriam.


_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to check message is XML well-formatted ?
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.