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 » generic xml validation

Post new topic  Reply to topic
 generic xml validation « View previous topic :: View next topic » 
Author Message
Nizam
PostPosted: Mon Aug 09, 2004 7:31 pm    Post subject: generic xml validation Reply with quote

Disciple

Joined: 10 Feb 2004
Posts: 160

Is there anyway that I can validate a generic xml message. I dont want to validate it against a dtd.
I tried using the mqinput and check node but does not solve my purpose because they validate only if i specify a dtd.
When an invalid xml message(e.g missing tag) passes the mqinput node, I can see 'Parsing Errors have occured' in the message structure, but I am not able to read this.
I am using wbimb v5 on windows 2000.
Any ideas guys,
Thanks
Back to top
View user's profile Send private message
WBI_user
PostPosted: Mon Aug 09, 2004 8:31 pm    Post subject: Reply with quote

Partisan

Joined: 07 Aug 2001
Posts: 386

You have to validate a message against something. If you don't want to use dtd or schema, the only way I can think of is using ESQL to ensure that the tag that you expect to exist does exist by using ESQL.
Back to top
View user's profile Send private message
wooda
PostPosted: Mon Aug 09, 2004 11:44 pm    Post subject: Reply with quote

Master

Joined: 21 Nov 2003
Posts: 265
Location: UK

Well you have to differenciate between validating that a message conforms to the xml standard and validating that it conforms to a specific dtd/schema.

I assume from what you have written that you mean the former.

The Generic XML parser and MRM XML parser will both do this as if the message if not valid xml you will get a parsing error. Which appears to be exactly what you have got.

Is your problem that you cannot get enough information from this error ?
Back to top
View user's profile Send private message
fazz
PostPosted: Tue Aug 10, 2004 7:17 am    Post subject: Reply with quote

Centurion

Joined: 20 Feb 2004
Posts: 144
Location: England

Maybe we should be clear about the term validating.
To validate an XML document is to check it against a DTD or Schema.

Most XML parser, including the one in WBIMB will check to see if the document is well formed i.e. meets the standard XML requirements (this is not validating)

If you need to 'catch' more info on the checking of well-formdness, you could wire up the catch terminal of the input node and handle it that way. You will then have access to the exception tree.
Back to top
View user's profile Send private message
Nizam
PostPosted: Tue Aug 10, 2004 5:48 pm    Post subject: Reply with quote

Disciple

Joined: 10 Feb 2004
Posts: 160

fazz,
This is what i have tested.
MQInput -> Compute(OutputRoot.XML = InputRoot.XML) -> MQOutput
MQInput nodes catch and failure terminal are connected to an exception handling flow.
I have set the default message domain to 'XML'.
When I put an invalid message it lands in MQOutput.
It was never caught on the catch node of MQInput.
I can still see the message 'XML Parsing errors have occured' in the message tree.
Please suggest me something to validate the well formedness of an XML.
Thanks for your replies.
Back to top
View user's profile Send private message
fazz
PostPosted: Wed Aug 11, 2004 12:32 am    Post subject: Reply with quote

Centurion

Joined: 20 Feb 2004
Posts: 144
Location: England

Hello,

The Broker will only parse the XML when nessecary i.e. when you reference it within a flow.

Cheers,
Fazz
Back to top
View user's profile Send private message
javaforvivek
PostPosted: Wed Aug 11, 2004 2:22 am    Post subject: Reply with quote

Master

Joined: 14 Jun 2002
Posts: 282
Location: Pune,India

XML Validation and XML Well-formed-ness are two different things.
For e.g., when you check that a <Tag> has its respective closing </Tag>, you are checking for well-formed-ness.
As all of experts have written here, XML Validation is relative. There has to be some schema or DTD against which you validate your XML Message.

It is very important to remember that,
Quote:

The Broker will only parse the XML when nessecary i.e. when you reference it within a flow.

So if you want to test the well-formed-ness of your XML Message, better do it before you pass the message to the flow. And to do this, you gave plenty of tools and APIs available.
_________________
Vivek
------------------------------------------------------
...when you have eliminated the impossible, whatever remains, however improbable, must be the truth.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
RAJESHRAMAKRISHNAN
PostPosted: Wed Aug 11, 2004 4:27 am    Post subject: Reply with quote

Voyager

Joined: 01 May 2004
Posts: 96

I am also facing the same problem. ie to just check whether the XML is well formed or not . Can anyone please let me know whether this can be done in ESQL ? I want this to be generic for all XML. ie I can't check for any particular tag in the XML.
Back to top
View user's profile Send private message
PGoodhart
PostPosted: Wed Aug 11, 2004 4:42 am    Post subject: Reply with quote

Master

Joined: 17 Jun 2004
Posts: 278
Location: Harrisburg PA

Which version of the broker are you using?
One possiblity is to write a VERY generic DTD and use that to validate against... I bet you can get it to fail and go to the proper queue then.

Or you could attack the XML as a BLOB and write your own well-formed routines.

You definately need to use one of the XML domains and not the MRM...
_________________
Patrick Goodhart
MQ Admin/Web Developer/Consultant
WebSphere Application Server Admin
Back to top
View user's profile Send private message
wooda
PostPosted: Wed Aug 11, 2004 5:14 am    Post subject: Reply with quote

Master

Joined: 21 Nov 2003
Posts: 265
Location: UK

If the XML is NOT well-formed then the parser will throw a parsing error.
If it does this then the message will go down the appropriate failure route in the flow. (eg. This will be the catch on the input if the failure terminal of the parsing node is not connected and you don't have a trycatch node). You can handle the error by examining the exception list in ESQL just like any other type of error.

Quote:
This is what i have tested.
MQInput -> Compute(OutputRoot.XML = InputRoot.XML) -> MQOutput
MQInput nodes catch and failure terminal are connected to an exception handling flow.
I have set the default message domain to 'XML'.
When I put an invalid message it lands in MQOutput.
It was never caught on the catch node of MQInput.
I can still see the message 'XML Parsing errors have occured' in the message tree.
Please suggest me something to validate the well formedness of an XML.
Thanks for your replies.


Nizam - If you are getting parsing errors and the message is still going to output it is because you have designed the flow that way.
Back to top
View user's profile Send private message
Nizam
PostPosted: Wed Aug 11, 2004 2:58 pm    Post subject: Reply with quote

Disciple

Joined: 10 Feb 2004
Posts: 160

Thanks wooda,
Having a trycatch solved my problem.

When the message passes my mqinput it looks as follows.
-XML
-MSG
-Header
-Body
-MYXML
-XML Parsing Errors have occured

I am interested in reading 'XML Parsing Errors have occured' from the message tree.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 11, 2004 3:25 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

So you want to catch the error, and then process the ExceptionList.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Nizam
PostPosted: Wed Aug 11, 2004 7:16 pm    Post subject: Reply with quote

Disciple

Joined: 10 Feb 2004
Posts: 160

Jefflowrey,
I want to catch the error. To be more clear if i see 'xml parsing errors have occured' I want to process my message in a different way.
I am just curious to read this message right away instead of handling at the catch terminal.
You know the exception tree is not generated until the put event occurs.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 11, 2004 7:28 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

So you do some stuff to create your new message.

Then you insert a Compute Node, that merely copies the Input Message to the Output Message.

And you tell the Compute Node to validate the data, immediately.

Then you attach some stuff to the catch terminal of the Compute node
_________________
I am *not* the model of the modern major general.
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 » generic xml validation
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.