/usr/share/doc/libacexml-dev/examples/SAXPrint/SAXPrint_Handler.cpp is in libacexml-dev 6.0.3+dfsg-0.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | // -*- C++ -*- $Id: SAXPrint_Handler.cpp 91257 2010-08-03 11:54:04Z johnnyw $
#include "SAXPrint_Handler.h"
#include "ace/ACE.h"
#include "ace/Log_Msg.h"
#if !defined (__ACEXML_INLINE__)
# include "SAXPrint_Handler.inl"
#endif /* __ACEXML_INLINE__ */
ACEXML_SAXPrint_Handler::ACEXML_SAXPrint_Handler (const ACEXML_Char* filename)
: indent_ (0), fileName_(ACE::strnew (filename)), locator_ (0)
{
// no-op
}
ACEXML_SAXPrint_Handler::~ACEXML_SAXPrint_Handler (void)
{
delete [] this->fileName_;
}
void
ACEXML_SAXPrint_Handler::characters (const ACEXML_Char *cdata,
size_t,
size_t)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("%s"),
cdata));
}
void
ACEXML_SAXPrint_Handler::endDocument (void)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
}
void
ACEXML_SAXPrint_Handler::endElement (const ACEXML_Char *,
const ACEXML_Char *,
const ACEXML_Char *qName)
{
this->dec_indent ();
this->print_indent ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("</%s>"),
qName));
}
void
ACEXML_SAXPrint_Handler::endPrefixMapping (const ACEXML_Char *)
{
// ACE_DEBUG ((LM_DEBUG,
// ACE_TEXT ("* Event endPrefixMapping (%s) ***************\n"),
// prefix));
}
void
ACEXML_SAXPrint_Handler::ignorableWhitespace (const ACEXML_Char * cdata,
int,
int)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("%s"),
cdata));
// ACE_DEBUG ((LM_DEBUG,
// ACE_TEXT ("* Event ignorableWhitespace () ***************\n")));
}
void
ACEXML_SAXPrint_Handler::processingInstruction (const ACEXML_Char *target,
const ACEXML_Char *data)
{
this->print_indent ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("<?%s %s>\n"),
target, data));
}
void
ACEXML_SAXPrint_Handler::setDocumentLocator (ACEXML_Locator * locator)
{
this->locator_ = locator;
//ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event setDocumentLocator () ***************\n")));
}
void
ACEXML_SAXPrint_Handler::skippedEntity (const ACEXML_Char *name)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("* Event skippedEntity (%s) ***************\n"),
name));
}
void
ACEXML_SAXPrint_Handler::startDocument (void)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("* Event startDocument () ***************\n")));
}
void
ACEXML_SAXPrint_Handler::startElement (const ACEXML_Char *,
const ACEXML_Char *,
const ACEXML_Char *qName,
ACEXML_Attributes *alist)
{
this->print_indent ();
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("<%s"),
qName));
if (alist != 0)
for (size_t i = 0; i < alist->getLength (); ++i)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT (" %s = \"%s\""),
alist->getQName (i), alist->getValue (i)));
}
ACE_DEBUG ((LM_DEBUG, ACE_TEXT (">")));
this->inc_indent ();
}
void
ACEXML_SAXPrint_Handler::startPrefixMapping (const ACEXML_Char * ,
const ACEXML_Char *)
{
// ACE_DEBUG ((LM_DEBUG,
// ACE_TEXT ("* Event startPrefixMapping () ***************\n")));
// ACE_DEBUG ((LM_DEBUG,
// ACE_TEXT ("Prefix = %s, URI = %s\n"), prefix, uri));
}
// *** Methods inherited from ACEXML_DTDHandler.
void
ACEXML_SAXPrint_Handler::notationDecl (const ACEXML_Char *,
const ACEXML_Char *,
const ACEXML_Char *)
{
// No-op.
}
void
ACEXML_SAXPrint_Handler::unparsedEntityDecl (const ACEXML_Char *,
const ACEXML_Char *,
const ACEXML_Char *,
const ACEXML_Char *)
{
// No-op.
}
// Methods inherited from ACEXML_EnitityResolver.
ACEXML_InputSource *
ACEXML_SAXPrint_Handler::resolveEntity (const ACEXML_Char *,
const ACEXML_Char *)
{
// No-op.
return 0;
}
// Methods inherited from ACEXML_ErrorHandler.
/*
* Receive notification of a recoverable error.
*/
void
ACEXML_SAXPrint_Handler::error (ACEXML_SAXParseException & ex)
{
ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ",
(this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()),
this->locator_->getLineNumber(),
this->locator_->getColumnNumber()));
ex.print();
}
void
ACEXML_SAXPrint_Handler::fatalError (ACEXML_SAXParseException & ex)
{
ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ",
(this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()),
this->locator_->getLineNumber(),
this->locator_->getColumnNumber()));
ex.print();
}
void
ACEXML_SAXPrint_Handler::warning (ACEXML_SAXParseException & ex)
{
ACE_DEBUG ((LM_DEBUG, "%s: line: %d col: %d ",
(this->locator_->getSystemId() == 0 ? this->fileName_ : this->locator_->getSystemId()),
this->locator_->getLineNumber(),
this->locator_->getColumnNumber()));
ex.print();
}
void
ACEXML_SAXPrint_Handler::print_indent (void)
{
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("\n")));
for (size_t i = 0; i < this->indent_; ++i)
ACE_DEBUG ((LM_DEBUG, ACE_TEXT (" ")));
}
|