Condition/error handler functions for XML parsing
These functions provide basic error handling for the XML parser in R. They also illustrate the basics which will allow others to provide customized error handlers that make more use of the information provided in each error reported.
xmlStructuredStop function provides a simple R-level handler for errors
raised by the XML parser.
It collects the information provided by the XML parser and
raises an R error.
This is only used if
NULL is specified for the
error argument of
The default is to use the function returned by a call to
xmlErrorCumulator as the error handler.
This, as the name suggests, cumulates errors.
The idea is to catch each error and let the parser continue
and then report them all.
As each error is encountered, it is collected by the function.
TRUE, the error is also reported on
When the parsing is complete and has failed, this function is
invoked again with a zero-length character vector as the
message (first argument) and then it raises an error.
This function will then raise an R condition of class
1 2 3
character string, the text of the message being reported
an integer code giving an identifier for the error (see xmlerror.h) for the moment,
an integer domain indicating in which "module" or part of the parsing the error occurred, e.g. name space, parser, tree, xinclude, etc.
an integer giving the line number in the XML content being processed corresponding to the error,
an integer giving the column position of the error,
an integer giving the severity of the error ranging from 1 to 3 in increasing severity (warning, error, fatal),
character string, the name of the document being processed, i.e. its file name or URL.
character vector, any classes to prepend to the class
attribute to make the error/condition. These are prepended to those
logical value, if
stop and so does not return a value.
Duncan Temple Lang
libxml2 and its error handling facilities (http://xmlsoft.org
1 2 3 4 5 6
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.