#include <XMLTool.hh>
Inheritance diagram for XMLHandlers:
Public Member Functions | |
XMLHandlers (const XMLTool &father, const char *const encodingName, const XMLFormatter::UnRepFlags unRepFlags) | |
~XMLHandlers () | |
Private Member Functions | |
string | XMLCh_to_String (const XMLCh *toTranscode) |
void | writeChars (const XMLByte *const toWrite) |
virtual void | writeChars (const XMLByte *const toWrite, const XMLSize_t count, XMLFormatter *const formatter) |
void | endDocument () |
void | endElement (const XMLCh *const name) |
void | characters (const XMLCh *const chars, const XMLSize_t length) |
void | ignorableWhitespace (const XMLCh *const chars, const XMLSize_t length) |
void | processingInstruction (const XMLCh *const target, const XMLCh *const data) |
void | startDocument () |
void | startElement (const XMLCh *const name, AttributeList &attributes) |
void | warning (const SAXParseException &exc) |
void | error (const SAXParseException &exc) |
void | fatalError (const SAXParseException &exc) |
void | notationDecl (const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId) |
void | unparsedEntityDecl (const XMLCh *const name, const XMLCh *const publicId, const XMLCh *const systemId, const XMLCh *const notationName) |
Private Attributes | |
XMLFormatter | fFormatter |
const XMLTool & | father |
Definition at line 59 of file XMLTool.hh.
XMLHandlers::XMLHandlers | ( | const XMLTool & | father, | |
const char *const | encodingName, | |||
const XMLFormatter::UnRepFlags | unRepFlags | |||
) |
Definition at line 75 of file XMLTool.cpp.
00077 : 00078 00079 fFormatter 00080 ( 00081 encodingName 00082 , 0 00083 , this 00084 , XMLFormatter::NoEscapes 00085 , unRepFlags 00086 ), 00087 father(aFather) 00088 { 00089 // 00090 // Go ahead and output an XML Decl with our known encoding. This 00091 // is not the best answer, but its the best we can do until we 00092 // have SAX2 support. 00093 // 00094 fFormatter << gXMLDecl1 << fFormatter.getEncodingName() << gXMLDecl2; 00095 }
XMLHandlers::~XMLHandlers | ( | ) |
string XMLHandlers::XMLCh_to_String | ( | const XMLCh * | toTranscode | ) | [private] |
void XMLHandlers::writeChars | ( | const XMLByte *const | toWrite | ) | [private] |
void XMLHandlers::writeChars | ( | const XMLByte *const | toWrite, | |
const XMLSize_t | count, | |||
XMLFormatter *const | formatter | |||
) | [private, virtual] |
Definition at line 109 of file XMLTool.cpp.
00112 { 00113 // For this one, just dump them to the standard output 00114 // Surprisingly, Solaris was the only platform on which 00115 // required the char* cast to print out the string correctly. 00116 // Without the cast, it was printing the pointer value in hex. 00117 // Quite annoying, considering every other platform printed 00118 // the string with the explicit cast to char* below. 00119 //XERCES_STD_QUALIFIER cout.write((char *) toWrite, (int) count); 00120 //XERCES_STD_QUALIFIER cout.flush(); 00121 //std::cout <<toWrite; 00122 }
void XMLHandlers::endDocument | ( | ) | [private] |
void XMLHandlers::endElement | ( | const XMLCh *const | name | ) | [private] |
Definition at line 188 of file XMLTool.cpp.
00189 { 00190 // No escapes are legal here 00191 //fFormatter << XMLFormatter::NoEscapes << gEndElement << name << chCloseAngle; 00192 }
void XMLHandlers::characters | ( | const XMLCh *const | chars, | |
const XMLSize_t | length | |||
) | [private] |
Definition at line 176 of file XMLTool.cpp.
00178 { 00179 fFormatter.formatBuf(chars, length, XMLFormatter::CharEscapes); 00180 }
void XMLHandlers::ignorableWhitespace | ( | const XMLCh *const | chars, | |
const XMLSize_t | length | |||
) | [private] |
Definition at line 195 of file XMLTool.cpp.
00197 { 00198 fFormatter.formatBuf(chars, length, XMLFormatter::NoEscapes); 00199 }
void XMLHandlers::processingInstruction | ( | const XMLCh *const | target, | |
const XMLCh *const | data | |||
) | [private] |
Definition at line 202 of file XMLTool.cpp.
00204 { 00205 //fFormatter << XMLFormatter::NoEscapes << gStartPI << target; 00206 //if (data) 00207 // fFormatter << chSpace << data; 00208 //fFormatter << XMLFormatter::NoEscapes << gEndPI; 00209 }
void XMLHandlers::startDocument | ( | ) | [private] |
void XMLHandlers::startElement | ( | const XMLCh *const | name, | |
AttributeList & | attributes | |||
) | [private] |
Definition at line 217 of file XMLTool.cpp.
00219 { 00220 // The name has to be representable without any escapes 00221 //fFormatter << XMLFormatter::NoEscapes 00222 // << chOpenAngle << name; 00223 //string balise, string key, string value) 00224 00225 // get the balise 00226 string balise = XMLCh_to_String(name); 00227 00228 // get key and value 00229 XMLSize_t len = attributes.getLength(); 00230 // For a balise -> 0 to n keys 00231 // map key <-> value 00232 map<string,string> key_value; 00233 for (XMLSize_t index = 0; index < len; index++) 00234 { 00235 string key = XMLCh_to_String( attributes.getName(index)); 00236 string value = XMLCh_to_String( attributes.getValue(index)); 00237 key_value[key]=value; 00238 //father.receiveEvent(balise,key,value); 00239 } 00240 father.receiveEvent(balise,key_value); 00241 //fFormatter << chCloseAngle; 00242 }
void XMLHandlers::warning | ( | const SAXParseException & | exc | ) | [private] |
Definition at line 144 of file XMLTool.cpp.
00145 { 00146 XERCES_STD_QUALIFIER cerr << "\nWarning at file " << StrX(e.getSystemId()) 00147 << ", line " << e.getLineNumber() 00148 << ", char " << e.getColumnNumber() 00149 << "\n Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl; 00150 }
void XMLHandlers::error | ( | const SAXParseException & | exc | ) | [private] |
Definition at line 128 of file XMLTool.cpp.
00129 { 00130 XERCES_STD_QUALIFIER cerr << "\nError at file " << StrX(e.getSystemId()) 00131 << ", line " << e.getLineNumber() 00132 << ", char " << e.getColumnNumber() 00133 << "\n Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl; 00134 }
void XMLHandlers::fatalError | ( | const SAXParseException & | exc | ) | [private] |
Definition at line 136 of file XMLTool.cpp.
00137 { 00138 XERCES_STD_QUALIFIER cerr << "\nFatal Error at file " << StrX(e.getSystemId()) 00139 << ", line " << e.getLineNumber() 00140 << ", char " << e.getColumnNumber() 00141 << "\n Message: " << StrX(e.getMessage()) << XERCES_STD_QUALIFIER endl; 00142 }
void XMLHandlers::notationDecl | ( | const XMLCh *const | name, | |
const XMLCh *const | publicId, | |||
const XMLCh *const | systemId | |||
) | [private] |
void XMLHandlers::unparsedEntityDecl | ( | const XMLCh *const | name, | |
const XMLCh *const | publicId, | |||
const XMLCh *const | systemId, | |||
const XMLCh *const | notationName | |||
) | [private] |
XMLFormatter XMLHandlers::fFormatter [private] |
Definition at line 159 of file XMLTool.hh.
Referenced by characters(), ignorableWhitespace(), and XMLHandlers().
const XMLTool& XMLHandlers::father [private] |