3 #include "SAXPrint_Handler.h"
5 #include "ace/Log_Msg.h"
7 #if !defined (__ACEXML_INLINE__)
8 # include "SAXPrint_Handler.inl"
9 #endif /* __ACEXML_INLINE__ */
11 ACEXML_SAXPrint_Handler::ACEXML_SAXPrint_Handler (const ACEXML_Char
* filename
)
12 : indent_ (0), fileName_(ACE::strnew (filename
)), locator_ (0)
16 ACEXML_SAXPrint_Handler::~ACEXML_SAXPrint_Handler ()
18 delete [] this->fileName_
;
22 ACEXML_SAXPrint_Handler::characters (const ACEXML_Char
*cdata
,
32 ACEXML_SAXPrint_Handler::endDocument ()
34 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("\n")));
38 ACEXML_SAXPrint_Handler::endElement (const ACEXML_Char
*,
40 const ACEXML_Char
*qName
)
43 this->print_indent ();
50 ACEXML_SAXPrint_Handler::endPrefixMapping (const ACEXML_Char
*)
52 // ACE_DEBUG ((LM_DEBUG,
53 // ACE_TEXT ("* Event endPrefixMapping (%s) ***************\n"),
58 ACEXML_SAXPrint_Handler::ignorableWhitespace (const ACEXML_Char
* cdata
,
65 // ACE_DEBUG ((LM_DEBUG,
66 // ACE_TEXT ("* Event ignorableWhitespace () ***************\n")));
70 ACEXML_SAXPrint_Handler::processingInstruction (const ACEXML_Char
*target
,
71 const ACEXML_Char
*data
)
73 this->print_indent ();
75 ACE_TEXT ("<?%s %s>\n"),
80 ACEXML_SAXPrint_Handler::setDocumentLocator (ACEXML_Locator
* locator
)
82 this->locator_
= locator
;
83 //ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("* Event setDocumentLocator () ***************\n")));
87 ACEXML_SAXPrint_Handler::skippedEntity (const ACEXML_Char
*name
)
90 ACE_TEXT ("* Event skippedEntity (%s) ***************\n"),
95 ACEXML_SAXPrint_Handler::startDocument ()
98 ACE_TEXT ("* Event startDocument () ***************\n")));
102 ACEXML_SAXPrint_Handler::startElement (const ACEXML_Char
*,
104 const ACEXML_Char
*qName
,
105 ACEXML_Attributes
*alist
)
107 this->print_indent ();
109 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("<%s"),
112 for (size_t i
= 0; i
< alist
->getLength (); ++i
)
114 ACE_DEBUG ((LM_DEBUG
,
115 ACE_TEXT (" %s = \"%s\""),
116 alist
->getQName (i
), alist
->getValue (i
)));
118 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT (">")));
123 ACEXML_SAXPrint_Handler::startPrefixMapping (const ACEXML_Char
* ,
126 // ACE_DEBUG ((LM_DEBUG,
127 // ACE_TEXT ("* Event startPrefixMapping () ***************\n")));
128 // ACE_DEBUG ((LM_DEBUG,
129 // ACE_TEXT ("Prefix = %s, URI = %s\n"), prefix, uri));
132 // *** Methods inherited from ACEXML_DTDHandler.
135 ACEXML_SAXPrint_Handler::notationDecl (const ACEXML_Char
*,
143 ACEXML_SAXPrint_Handler::unparsedEntityDecl (const ACEXML_Char
*,
151 // Methods inherited from ACEXML_EnitityResolver.
154 ACEXML_SAXPrint_Handler::resolveEntity (const ACEXML_Char
*,
161 // Methods inherited from ACEXML_ErrorHandler.
164 * Receive notification of a recoverable error.
167 ACEXML_SAXPrint_Handler::error (ACEXML_SAXParseException
& ex
)
169 ACE_DEBUG ((LM_DEBUG
, "%s: line: %d col: %d ",
170 (this->locator_
->getSystemId() == 0 ? this->fileName_
: this->locator_
->getSystemId()),
171 this->locator_
->getLineNumber(),
172 this->locator_
->getColumnNumber()));
177 ACEXML_SAXPrint_Handler::fatalError (ACEXML_SAXParseException
& ex
)
179 ACE_DEBUG ((LM_DEBUG
, "%s: line: %d col: %d ",
180 (this->locator_
->getSystemId() == 0 ? this->fileName_
: this->locator_
->getSystemId()),
181 this->locator_
->getLineNumber(),
182 this->locator_
->getColumnNumber()));
187 ACEXML_SAXPrint_Handler::warning (ACEXML_SAXParseException
& ex
)
189 ACE_DEBUG ((LM_DEBUG
, "%s: line: %d col: %d ",
190 (this->locator_
->getSystemId() == 0 ? this->fileName_
: this->locator_
->getSystemId()),
191 this->locator_
->getLineNumber(),
192 this->locator_
->getColumnNumber()));
197 ACEXML_SAXPrint_Handler::print_indent ()
199 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT ("\n")));
200 for (size_t i
= 0; i
< this->indent_
; ++i
)
201 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT (" ")));