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 IndexWebSphere Message Broker SupportError Handler Notification for XML data Tips needed

Post new topicReply to topic
Error Handler Notification for XML data Tips needed View previous topic :: View next topic
Author Message
anil kumar
PostPosted: Tue Sep 11, 2018 1:26 am Post subject: Error Handler Notification for XML data Tips needed Reply with quote

Apprentice

Joined: 22 Jan 2017
Posts: 48
Location: somewhere under the sky

Dear Experts ,
when ever we are working with the XML files we are using the XMLNSC parser and XSD schema files and we use
Quote:

Validation : content and value
Failure Action : exception list
parser timing : Complete .

whenever (if any) schema validation failures occur i use a error handler whichi will use the exception list and grabs the inserts from parser exception and sends me a notification of the Error description.
but the error description is giving the elements xpath , line number(which is always 1 barbecue broker take whole xml as a single line) , column number(same as 1) and offset(expected element location ).
like this :
Quote:

A schema validation error has occurred while parsing the XML document 5011 2 1 286 Unexpected end element event. The content of element "Body" is not complete. /Root/XMLNSC/Request/Body

but some people find this description is not understandable(becase lack of technical skills as they are from bussiness).
does any one have better error handler for XML.
if you have any Better designs or ideas for this please suggest.

Thanks ,
AK.
_________________
Anil Varma
Back to top
View user's profile Send private message
timber
PostPosted: Wed Sep 12, 2018 12:12 am Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 838

Errors issued by XML parsers are sometimes good, sometimes OK but often they are awful. It's not an easy problem to solve because of the complexity of XML and XML Schema.

To take the example that you quoted, the XML parser could report something like this:
Code:
A schema validation error has occurred while parsing the XML document. Element "Body" is not valid because child element 'Body/foo' is missing. /Root/XMLNSC/Request/Body
Sometimes that would be a good, accurate error message, but in a complex schema the actual error might be a lot more complex. So the developers who write XML parsers just report that the parent element is 'not complete'.

For similar reasons (i.e. possibly complex schemas) the 'Exception list' option does not do what most people think. It only reports multiple errors if the errors are in the simple value of a simple element. Any errors caused by unexpected or missing tag names will stop the XMLNSC parser immediately.

Your comment re: treating the XML as a single line puzzled me...IIB does not throw away line breaks. I assume that the sender is sending a single-line document.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Sep 12, 2018 4:53 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25165
Location: Ohio, USA

timber wrote:
Your comment re: treating the XML as a single line puzzled me...IIB does not throw away line breaks. I assume that the sender is sending a single-line document.




Remember that when you look at an XML message, a lot of XML aware tools (XMLSpy et al) format the document to aid human readability; I believe XMLSpy calls this "pretty print". The IIB XML parser like all parsers ignore this, and XML serializes don't format XML like this.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
anil kumar
PostPosted: Thu Sep 13, 2018 3:21 am Post subject: Reply with quote

Apprentice

Joined: 22 Jan 2017
Posts: 48
Location: somewhere under the sky

Thanks for the Suggestions
_________________
Anil Varma


Last edited by anil kumar on Thu Sep 13, 2018 11:00 pm; edited 1 time in total
Back to top
View user's profile Send private message
timber
PostPosted: Thu Sep 13, 2018 7:14 am Post subject: Reply with quote

Sentinel

Joined: 25 Aug 2015
Posts: 838

Quote:
just like vitor said the xmlnsc parser will parse the data as a single line
Vitor did not say that. He agreed with me, that IIB simply processes whatever XML it receives. If the incoming XML has multiple lines then IIB error messages will report them. But if the incoming XML is a single line then IIB cannot invent a line number
Quote:
Might be a case that I should write a custom java adapter on my own ?
What would your Java adaptor do? I hope you are not even *thinking* about writing your own XML parser.
Quote:
Or should I write a parsing program in java like sax /dom/vtd-xml ? And use it when ever I need?
If you go down that road then you are making an assumption. You are assuming that Java XML parser always emits error messages that meet your requirements.

Going back to your original requirement...why is important to emit XML error messages that the business user can understand? They are not designed for business users. I recommend that you think carefully about what you're trying to achieve before spending a lot of time addressing this 'requirement'.
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Sep 13, 2018 7:35 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 25165
Location: Ohio, USA

timber wrote:
Quote:
just like vitor said the xmlnsc parser will parse the data as a single line
Vitor did not say that. He agreed with me, that IIB simply processes whatever XML it receives. If the incoming XML has multiple lines then IIB error messages will report them. But if the incoming XML is a single line then IIB cannot invent a line number


The use of the emoticon should have been a clue.

Again, the XML being parsed has no intrinsic connection to the same XML displayed by any number of tools. Even if (though some dark magic) IIB generated a line number, there's no guarantee this line number correlates to anything the user would see. Suppose IIB calculated the line number by counting end tabs, but XMLSpy honoured the line break characters in the document???

timber wrote:
Quote:
Might be a case that I should write a custom java adapter on my own ?
What would your Java adaptor do? I hope you are not even *thinking* about writing your own XML parser.


Your own XML parser? That's saying you don't like your car so you'll invent your own. I offer the owner of Tesla as a salutary warning......

timber wrote:
Quote:
Or should I write a parsing program in java like sax /dom/vtd-xml ? And use it when ever I need?
If you go down that road then you are making an assumption. You are assuming that Java XML parser always emits error messages that meet your requirements.


Ah - so those parsers work an entirely different way to the one in IIB given the same source data?



timber wrote:
Going back to your original requirement...why is important to emit XML error messages that the business user can understand? They are not designed for business users. I recommend that you think carefully about what you're trying to achieve before spending a lot of time addressing this 'requirement'.




And for the record, as this seemed unclear last time, I agree with @timber. An XML document is human readable on a technicality and certainly not intended for a non-technical person. Assuming this business person can understand the error, or is by more dark magic given an error he can understand, what exactly is he going to do about it that won't involve a technical person? Is this business person then going to fix the code in the application that publishes the XML?

If so, I put it to you this "business" person is a technician, probably a programmer, who can read XML documents without the aid of highly formatted error messages.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker SupportError Handler Notification for XML data Tips needed
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.