|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
![Reply to topic](templates/DAJ_Glass/images/lang_english/reply.gif) |
|
Error Handler Notification for XML data Tips needed |
« View previous topic :: View next topic » |
Author |
Message
|
anil kumar |
Posted: Tue Sep 11, 2018 1:26 am Post subject: Error Handler Notification for XML data Tips needed |
|
|
![](images/avatars/gallery/dragonballz/vegeta.gif) Voyager
Joined: 22 Jan 2017 Posts: 97 Location: India
|
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. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
timber |
Posted: Wed Sep 12, 2018 12:12 am Post subject: |
|
|
![](images/avatars/53508560955fb354bd4bd0.jpg) Grand Master
Joined: 25 Aug 2015 Posts: 1280
|
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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Vitor |
Posted: Wed Sep 12, 2018 4:53 am Post subject: |
|
|
![](images/avatars/905340816499abc1cdfb07.jpg) Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, 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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
anil kumar |
Posted: Thu Sep 13, 2018 3:21 am Post subject: |
|
|
![](images/avatars/gallery/dragonballz/vegeta.gif) Voyager
Joined: 22 Jan 2017 Posts: 97 Location: India
|
Thanks for the Suggestions
Last edited by anil kumar on Thu Sep 13, 2018 11:00 pm; edited 1 time in total |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
timber |
Posted: Thu Sep 13, 2018 7:14 am Post subject: |
|
|
![](images/avatars/53508560955fb354bd4bd0.jpg) Grand Master
Joined: 25 Aug 2015 Posts: 1280
|
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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Vitor |
Posted: Thu Sep 13, 2018 7:35 am Post subject: |
|
|
![](images/avatars/905340816499abc1cdfb07.jpg) Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, 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 ![](images/smiles/icon_smile.gif) |
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 |
|
![](templates/DAJ_Glass/images/spacer.gif) |
|
|
![Reply to topic](templates/DAJ_Glass/images/lang_english/reply.gif) |
|
Page 1 of 1 |
|
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
|
|
|
|