XML Error Handling Reference

This section describes how the different components dealing with XML manage error conditions.

In all cases, ensure that your XML is valid and well-formed when using one of the parsers below.

libxml2 component

The libxml2 C library has its own error codes and returns NULL pointers in Out-Of-Memory conditions. It also stores the last parsing error in a member of the global _xmlGlobalState structure. Access this variable using TLS (Thread-Local Storage).

The methods of the Utilities wrapper leave when they detect an Out-Of-Memory condition in the libxml2 library.

XML DOM Engine

When calling a method of the XML DOM Engine, check its return value for an error code.

Methods that leave do so in Out-Of-Memory conditions. Methods that read or write files also leave on I/O errors.

XML DOM Engine Serialiser

The serialiser does not forward all the libxml2 errors and may leave with the Symbian platform mechanism instead.

XML Framework

The libxml2 SAX plugin maps the errors received from the libxml2 parser to parsing events. The leave mechanism only applies when the error is fatal for the libxml2 parser.

The Expat and WBXML parser plugins use a combination of parsing events and leaves to handle errors.

Related concepts