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

SAXPrint_Handler.cpp

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

Generated on Mon Jun 16 13:23:25 2003 for ACEXML by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002