00001
00002
00003 #include "Print_Handler.h"
00004 #include "ace/ACE.h"
00005 #include "ace/Log_Msg.h"
00006
00007 ACEXML_Print_Handler::ACEXML_Print_Handler (ACEXML_Char* fileName)
00008 : fileName_(ACE::strnew (fileName))
00009 {
00010
00011 }
00012
00013 ACEXML_Print_Handler::~ACEXML_Print_Handler (void)
00014 {
00015 delete[] this->fileName_;
00016 }
00017
00018 void
00019 ACEXML_Print_Handler::characters (const ACEXML_Char *cdata,
00020 int start,
00021 int length ACEXML_ENV_ARG_DECL_NOT_USED)
00022 ACE_THROW_SPEC ((ACEXML_SAXException))
00023 {
00024
00025
00026 ACE_DEBUG ((LM_DEBUG,
00027 ACE_TEXT ("* Event characters () ** start: %d end: %d ***************\n%s\n- End event characters () ---------------\n"),
00028 start, length, cdata));
00029 }
00030
00031 void
00032 ACEXML_Print_Handler::endDocument (ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED)
00033 ACE_THROW_SPEC ((ACEXML_SAXException))
00034 {
00035
00036
00037 ACE_DEBUG ((LM_DEBUG,
00038 ACE_TEXT ("* Event endDocument () ***************\n")));
00039 }
00040
00041 void
00042 ACEXML_Print_Handler::endElement (const ACEXML_Char *uri,
00043 const ACEXML_Char *name,
00044 const ACEXML_Char *qName
00045 ACEXML_ENV_ARG_DECL_NOT_USED)
00046 ACE_THROW_SPEC ((ACEXML_SAXException))
00047 {
00048
00049
00050 ACE_DEBUG ((LM_DEBUG,
00051 ACE_TEXT ("* Event endElement (%s, %s, %s) ***************\n"),
00052 uri, name, qName));
00053 }
00054
00055 void
00056 ACEXML_Print_Handler::endPrefixMapping (const ACEXML_Char *prefix
00057 ACEXML_ENV_ARG_DECL_NOT_USED)
00058 ACE_THROW_SPEC ((ACEXML_SAXException))
00059 {
00060
00061
00062 ACE_DEBUG ((LM_DEBUG,
00063 ACE_TEXT ("* Event endPrefixMapping (%s) ***************\n"),
00064 prefix));
00065 }
00066
00067 void
00068 ACEXML_Print_Handler::ignorableWhitespace (const ACEXML_Char *,
00069 int,
00070 int
00071 ACEXML_ENV_ARG_DECL_NOT_USED)
00072 ACE_THROW_SPEC ((ACEXML_SAXException))
00073 {
00074
00075
00076 }
00077
00078 void
00079 ACEXML_Print_Handler::processingInstruction (const ACEXML_Char *target,
00080 const ACEXML_Char *data
00081 ACEXML_ENV_ARG_DECL_NOT_USED)
00082 ACE_THROW_SPEC ((ACEXML_SAXException))
00083 {
00084
00085
00086 ACE_DEBUG ((LM_DEBUG,
00087 ACE_TEXT ("* Event processingInstruction (%s, %s) ***************\n"),
00088 target, data));
00089 }
00090
00091 void
00092 ACEXML_Print_Handler::setDocumentLocator (ACEXML_Locator * locator)
00093 {
00094
00095 this->locator_ = locator;
00096
00097 }
00098
00099 void
00100 ACEXML_Print_Handler::skippedEntity (const ACEXML_Char *name
00101 ACEXML_ENV_ARG_DECL_NOT_USED)
00102 ACE_THROW_SPEC ((ACEXML_SAXException))
00103 {
00104
00105
00106 ACE_DEBUG ((LM_DEBUG,
00107 ACE_TEXT ("* Event skippedEntity (%s) ***************\n"),
00108 name));
00109 }
00110
00111 void
00112 ACEXML_Print_Handler::startDocument (ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED)
00113 ACE_THROW_SPEC ((ACEXML_SAXException))
00114 {
00115
00116
00117 ACE_DEBUG ((LM_DEBUG,
00118 ACE_TEXT ("* Event startDocument () ***************\n")));
00119 }
00120
00121 void
00122 ACEXML_Print_Handler::startElement (const ACEXML_Char *uri,
00123 const ACEXML_Char *name,
00124 const ACEXML_Char *qName,
00125 ACEXML_Attributes *alist
00126 ACEXML_ENV_ARG_DECL_NOT_USED)
00127 ACE_THROW_SPEC ((ACEXML_SAXException))
00128 {
00129
00130
00131 ACE_DEBUG ((LM_DEBUG,
00132 ACE_TEXT ("* Event startElement (%s, %s, %s) ***************\n"),
00133 uri, name, qName));
00134
00135 if (alist != 0)
00136 for (size_t i = 0; i < alist->getLength (); ++i)
00137 {
00138 ACE_DEBUG ((LM_DEBUG,
00139 ACE_TEXT (" %s = \"%s\"\n"),
00140 alist->getQName (i), alist->getValue (i)));
00141 }
00142 }
00143
00144 void
00145 ACEXML_Print_Handler::startPrefixMapping (const ACEXML_Char * prefix,
00146 const ACEXML_Char * uri ACEXML_ENV_ARG_DECL_NOT_USED)
00147 ACE_THROW_SPEC ((ACEXML_SAXException))
00148 {
00149 ACE_DEBUG ((LM_DEBUG,
00150 ACE_TEXT ("* Event startPrefixMapping () ***************\n")));
00151 ACE_DEBUG ((LM_DEBUG,
00152 ACE_TEXT ("Prefix = %s, URI = %s\n"), prefix, uri));
00153 }
00154
00155
00156
00157 void
00158 ACEXML_Print_Handler::notationDecl (const ACEXML_Char *name,
00159 const ACEXML_Char *publicID,
00160 const ACEXML_Char *systemID ACEXML_ENV_ARG_DECL_NOT_USED)
00161 ACE_THROW_SPEC ((ACEXML_SAXException))
00162 {
00163 ACE_DEBUG ((LM_DEBUG,
00164 ACE_TEXT ("* Event notationDecl: (%s) "),
00165 name));
00166
00167 if (publicID == 0)
00168 ACE_DEBUG ((LM_DEBUG,
00169 ACE_TEXT ("SYSTEM %s\n"),
00170 systemID));
00171 else if (systemID == 0)
00172 ACE_DEBUG ((LM_DEBUG,
00173 ACE_TEXT ("PUBLIC %s\n"),
00174 publicID));
00175 else
00176 ACE_DEBUG ((LM_DEBUG,
00177 ACE_TEXT ("PUBLIC %s %s\n"),
00178 publicID, systemID));
00179 }
00180
00181 void
00182 ACEXML_Print_Handler::unparsedEntityDecl (const ACEXML_Char *name,
00183 const ACEXML_Char *publicID,
00184 const ACEXML_Char *systemID,
00185 const ACEXML_Char *notationName ACEXML_ENV_ARG_DECL_NOT_USED)
00186 ACE_THROW_SPEC ((ACEXML_SAXException))
00187 {
00188 ACE_DEBUG ((LM_DEBUG,
00189 ACE_TEXT ("* Unparsed Entity: %s"),
00190 name));
00191
00192 if (publicID == 0)
00193 ACE_DEBUG ((LM_DEBUG,
00194 ACE_TEXT (" SYSTEM %s"),
00195 systemID));
00196 else
00197 ACE_DEBUG ((LM_DEBUG,
00198 ACE_TEXT (" PUBLIC %s %s"),
00199 publicID, systemID));
00200
00201 ACE_DEBUG ((LM_DEBUG,
00202 ACE_TEXT (" NDATA %s\n"),
00203 notationName));
00204 }
00205
00206
00207
00208 ACEXML_InputSource *
00209 ACEXML_Print_Handler::resolveEntity (const ACEXML_Char *,
00210 const ACEXML_Char * ACEXML_ENV_ARG_DECL_NOT_USED)
00211 ACE_THROW_SPEC ((ACEXML_SAXException))
00212 {
00213
00214 return 0;
00215 }
00216
00217
00218
00219
00220
00221
00222 void
00223 ACEXML_Print_Handler::error (ACEXML_SAXParseException & ex ACEXML_ENV_ARG_DECL_NOT_USED)
00224 ACE_THROW_SPEC ((ACEXML_SAXException))
00225 {
00226 ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ",
00227 (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()),
00228 this->locator_->getLineNumber(),
00229 this->locator_->getColumnNumber()));
00230 ex.print();
00231 }
00232
00233 void
00234 ACEXML_Print_Handler::fatalError (ACEXML_SAXParseException& ex ACEXML_ENV_ARG_DECL_NOT_USED)
00235 ACE_THROW_SPEC ((ACEXML_SAXException))
00236 {
00237 ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ",
00238 (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()),
00239 this->locator_->getLineNumber(),
00240 this->locator_->getColumnNumber()));
00241 ex.print();
00242
00243 }
00244
00245 void
00246 ACEXML_Print_Handler::warning (ACEXML_SAXParseException & ex ACEXML_ENV_ARG_DECL_NOT_USED)
00247 ACE_THROW_SPEC ((ACEXML_SAXException))
00248 {
00249 ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ",
00250 (this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()),
00251 this->locator_->getLineNumber(),
00252 this->locator_->getColumnNumber()));
00253 ex.print();
00254 }