XML - Error handler function

Error handler function

!function func_id(event_code, message, public_id, sys_id, row, column)

The error handler receives errors, including warnings, recoverable errors and fatal errors. Errors can be generated by using malformed XML, or by using the XML vocabulary badly (not as defined in the DTD). The error handler provides the means to validate XML data and to retrieve information about any validation failures.

While it is useful to be able to retrieve information about errors, it should be noted that one of the requisites for an XML file is that it be well formed. If it has an error it is useless.

The document handler function is set with xml_set_error_handler(). See Registration of handler functions.

Possible event codes for the error handler function, defined in xml.h, are:

XML_EV_ERROR

A recoverable error. Validation error.

XML_EV_FATAL_ERROR

Not a well-formed XML document. Can be a non-recoverable error.

XML_EV_WARNING

Non-errors or fatal errors.


EXAMPLE

     xml_set_error_handler(fErrorHandler)

!function fErrorHandler(ev, msg, pub_id, sys_id, row, column) {
     error "Error Event(" + tostr(ev) + ") PublicId(" + pub_id + \
          ") SysId(" + sys_id + ") Line(" + tostr(row) + \
          ") Column(" + tostr(column) + ")" + "Message (" + msg + ")"
}

RELATED TOPICS

XML