Author |
Message
|
Bell Hung |
Posted: Thu Apr 18, 2002 10:16 pm Post subject: |
|
|
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 |
|
 |
kwelch |
Posted: Fri Apr 19, 2002 4:48 am Post subject: |
|
|
 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 |
|
 |
kirani |
Posted: Fri Apr 19, 2002 8:36 am Post subject: |
|
|
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 |
|
 |
Bell Hung |
Posted: Thu Apr 25, 2002 2:33 pm Post subject: |
|
|
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 |
|
 |
kirani |
Posted: Fri Apr 26, 2002 7:58 am Post subject: |
|
|
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 |
|
 |
psk |
Posted: Fri Apr 26, 2002 9:04 am Post subject: |
|
|
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 |
|
 |
Miriam Kaestner |
Posted: Sat Apr 27, 2002 11:19 am Post subject: |
|
|
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 |
|
 |
kirani |
Posted: Tue Apr 30, 2002 9:03 pm Post subject: |
|
|
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 |
|
 |
|