class Poco::XML::SAXParseException

Overview

Encapsulate an XML parse error or warning. Moreā€¦

#include <SAXException.h>

class SAXParseException: public SAXException
{
public:
    // construction

    SAXParseException(
        const std::string& msg,
        const Locator& loc
        );

    SAXParseException(
        const std::string& msg,
        const Locator& loc,
        const Poco::Exception& exc
        );

    SAXParseException(
        const std::string& msg,
        const XMLString& publicId,
        const XMLString& systemId,
        int lineNumber,
        int columnNumber
        );

    SAXParseException(
        const std::string& msg,
        const XMLString& publicId,
        const XMLString& systemId,
        int lineNumber,
        int columnNumber,
        const Poco::Exception& exc
        );

    SAXParseException(const SAXParseException& exc);

    // methods

    SAXParseException&
    operator=(const SAXParseException& exc);

    const char*
    name() const;

    const char*
    className() const;

    Poco::Exception*
    clone() const;

    void
    rethrow() const;

    const XMLString&
    getPublicId() const;

    const XMLString&
    getSystemId() const;

    int
    getLineNumber() const;

    int
    getColumnNumber() const;

protected:
    // methods

    static
    std::string
    buildMessage(
        const std::string& msg,
        const XMLString& publicId,
        const XMLString& systemId,
        int lineNumber,
        int columnNumber
        );
};

Detailed Documentation

Encapsulate an XML parse error or warning.

This exception may include information for locating the error in the original XML document, as if it came from a Locator object. Note that although the application will receive a SAXParseException as the argument to the handlers in the ErrorHandler interface, the application is not actually required to throw the exception; instead, it can simply read the information in it and take a different action.

Since this exception is a subclass of SAXException, it inherits the ability to wrap another exception.

Construction

SAXParseException(
    const std::string& msg,
    const Locator& loc
    )

Create a new SAXParseException from a message and a Locator.

SAXParseException(
    const std::string& msg,
    const Locator& loc,
    const Poco::Exception& exc
    )

Wrap an existing exception in a SAXParseException.

SAXParseException(
    const std::string& msg,
    const XMLString& publicId,
    const XMLString& systemId,
    int lineNumber,
    int columnNumber
    )

Create a new SAXParseException with an embedded exception.

This constructor is most useful for parser writers. All parameters except the message are as if they were provided by a Locator. For example, if the system identifier is a URL (including relative filename), the caller must resolve it fully before creating the exception.

SAXParseException(
    const std::string& msg,
    const XMLString& publicId,
    const XMLString& systemId,
    int lineNumber,
    int columnNumber,
    const Poco::Exception& exc
    )

Create a new SAXParseException.

This constructor is most useful for parser writers. All parameters except the message are as if they were provided by a Locator. For example, if the system identifier is a URL (including relative filename), the caller must resolve it fully before creating the exception.

SAXParseException(const SAXParseException& exc)

Creates a new SAXParseException from another one.

Methods

SAXParseException&
operator=(const SAXParseException& exc)

Assignment operator.

const char*
name() const

Returns a static string describing the exception.

const char*
className() const

Returns the name of the exception class.

Poco::Exception*
clone() const

Creates an exact copy of the exception.

void
rethrow() const

(Re)Throws the exception.

const XMLString&
getPublicId() const

Get the public identifier of the entity where the exception occurred.

const XMLString&
getSystemId() const

Get the system identifier of the entity where the exception occurred.

int
getLineNumber() const

The line number of the end of the text where the exception occurred.

The first line is line 1.

int
getColumnNumber() const

The column number of the end of the text where the exception occurred.

The first column in a line is position 1.