[xml] Current error handling scheme

Date view Thread view Subject view Author view

From: Harry Blundell (harry@halcyoninc.com)
Date: Thu Oct 26 2000 - 17:41:32 EDT


Hi,

The new scheme for handling errors within the library is working well for
me - thanks Daniel!

I do however, have a general question about it:

For reporting parsing and validation errors within the library, the error
handling functions take a xmlParserCtxtPtr as their first argument.
This is typically passed the location of {current context: one of
xmlParserCtxt or xmlValidCtxt}.userData, into which the current
xmlParserCtxtPtr has been put. Isn't userData reserved for what it
sounds like?

Until I went through the code, I had no idea that the userData was
relevant to me. I got nailed because I was doing the following:

  xmlValidCtxt validateContext;
  validateContext.error = myValidatorErrorFunction;
  validateContext.warning = myValidatorWarningFunction;

  return xmlValidateDocument(&validateContext, myDocPtr);

without setting

  validateContext.userData = NULL;

- I think I was picking up non-NULL garbage in validateContext.userData
which was interpreted as an xmlParserCtxtPtr, and caused crashes.

Harry
----------------------------------------------------------------------
Harry Blundell Halcyon Inc. URL: http://www.HalcyonInc.com
2300 Yonge St., Suite 1801, Box 2419, Toronto ON M4P 1E4, Canada.
PHONE: 416-932-4631 FAX: 416-932-4711 EMAIL: harry@HalcyonInc.com

----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Oct 26 2000 - 17:46:12 EDT