Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

cppdom::XMLError Class Reference

xml error class contains an XMLErrorCode and is thrown while parsing xml input. More...

#include <cppdom.h>

List of all members.

Public Methods

 XMLError (XMLErrorCode code)
 constructor. More...

XMLErrorCode getError () const
 returns the error code. More...

void getStrError (std::string &error) const
 returns the string representation of the error code. More...

std::string getString () const
std::string getInfo () const
 return additional error info. More...


Protected Attributes

XMLErrorCode mErrorCode


Detailed Description

xml error class contains an XMLErrorCode and is thrown while parsing xml input.

Definition at line 103 of file cppdom.h.


Constructor & Destructor Documentation

cppdom::XMLError::XMLError XMLErrorCode    code
 

constructor.

Definition at line 54 of file cppdom.cpp.

References cppdom::XMLErrorCode.

00055       : mErrorCode(code)
00056    {}


Member Function Documentation

XMLErrorCode cppdom::XMLError::getError   const
 

returns the error code.

Definition at line 58 of file cppdom.cpp.

References mErrorCode, and cppdom::XMLErrorCode.

00059    {
00060       return mErrorCode;
00061    }

std::string cppdom::XMLError::getInfo   const
 

return additional error info.

Definition at line 98 of file cppdom.cpp.

00099    {
00100       return "unknown error";
00101    }

void cppdom::XMLError::getStrError std::string &    error const
 

returns the string representation of the error code.

Definition at line 63 of file cppdom.cpp.

References cppdom::xml_attr_equal_expected, cppdom::xml_attr_value_expected, cppdom::xml_closetag_expected, cppdom::xml_closetag_slash_expected, cppdom::xml_dummy, cppdom::xml_file_access, cppdom::xml_filename_invalid, cppdom::xml_instream_error, cppdom::xml_opentag_cdata_expected, cppdom::xml_opentag_expected, cppdom::xml_pi_doctype_expected, cppdom::xml_save_invalid_nodetype, cppdom::xml_tagname_close_mismatch, cppdom::xml_tagname_expected, and cppdom::xml_unknown.

Referenced by getString().

00064    {
00065    // macro for keeping the errorcode switch short and easy
00066 #define XMLERRORCODE(x,y)  case x: err = y; break;
00067 
00068       const char *err;
00069       switch(mErrorCode)
00070       {
00071          XMLERRORCODE(xml_unknown,"unspecified or unknown error");
00072          XMLERRORCODE(xml_instream_error,"error in the infile stream");
00073          XMLERRORCODE(xml_opentag_expected,"expected an open tag literal '<'");
00074          XMLERRORCODE(xml_opentag_cdata_expected,"expected a '<' or cdata");
00075          XMLERRORCODE(xml_closetag_expected,"expected an '>' closing tag literal");
00076          XMLERRORCODE(xml_pi_doctype_expected,"expected a processing instruction or doctype tag");
00077          XMLERRORCODE(xml_tagname_expected,"expected a tag name after '<' or '</'");
00078          XMLERRORCODE(xml_closetag_slash_expected,"expected a '/' after closing tag literal '<'");
00079          XMLERRORCODE(xml_tagname_close_mismatch,"tag name from start and end tag mismatch");
00080          XMLERRORCODE(xml_attr_equal_expected,"expected '=' after attribute name");
00081          XMLERRORCODE(xml_attr_value_expected,"expected value after 'a' in attribute");
00082          XMLERRORCODE(xml_save_invalid_nodetype,"invalid nodetype encountered while saving");
00083          XMLERRORCODE(xml_filename_invalid,"invalid file name");
00084          XMLERRORCODE(xml_file_access,"could not access file");
00085          XMLERRORCODE(xml_dummy,"dummy error code (this error should never been seen)");
00086       }
00087       error.assign(err);
00088 #undef XMLERRORCODE
00089    }

std::string cppdom::XMLError::getString   const
 

Definition at line 91 of file cppdom.cpp.

References getStrError().

00092    {
00093       std::string err;
00094       getStrError(err);
00095       return err;
00096    }


Member Data Documentation

XMLErrorCode cppdom::XMLError::mErrorCode [protected]
 

Definition at line 121 of file cppdom.h.

Referenced by getError().


The documentation for this class was generated from the following files:
Generated on Thu Jan 2 21:29:21 2003 for cppdom by doxygen1.2.15