RE: [xml] Error handling with the XmlReader API



I'm polishing the error handling interface a little bit...

I think that providing locator information as an opaque
type would help future-proofing the API (in case we want
to provide additional error context in the future). 

I'm planning to do something like this:

typedef void *xmlTextReaderLocatorPtr;
typedef void (*xmlTextReaderErrorFunc)(void *arg, 
                                                   const char *msg,
                                                   xmlParserSeverities severity,
                                                   xmlTextReaderLocatorPtr locator);
int             xmlTextReaderLocatorGetLine     (xmlTextReaderLocatorPtr locator);
int             xmlTextReaderLocatorGetCol      (xmlTextReaderLocatorPtr locator);
const char *    xmlTextReaderLocatorGetSystemId (xmlTextReaderLocatorPtr locator);

The lifetime of the locator would be the duration of the callback,
of course.

Is this ok for you?

-sbi




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]