00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include <qgarlib/xercesimpl/XercesQgarContentHandlerAdaptor.H>
00045
00046
00047 #include <qgarlib/sax/ContentHandler.H>
00048 #include <qgarlib/sax/SAXException.H>
00049 #include <qgarlib/xercesimpl/XercesAttributesAdaptor.H>
00050 #include <qgarlib/xercesimpl/XercesLocatorAdaptor.H>
00051
00052
00053 #include <xercesc/sax/SAXException.hpp>
00054
00055 namespace qgxml {
00056
00057
00058
00059
00060
00061
00062 XercesQgarContentHandlerAdaptor::XercesQgarContentHandlerAdaptor(
00063 qgxml::ContentHandler * handler
00064 )
00065 {
00066 _impl = handler;
00067 _locatorImpl = 0;
00068 }
00069
00070
00071
00072
00073
00074
00075
00076
00077 XercesQgarContentHandlerAdaptor::~XercesQgarContentHandlerAdaptor()
00078 {
00079 delete _locatorImpl;
00080 }
00081
00082
00083
00084
00085
00086
00087
00088 void
00089 XercesQgarContentHandlerAdaptor::characters(const XMLCh * const chars,
00090 const unsigned int length)
00091 {
00092 try {
00093
00094 _impl->characters(_sc(chars).c_str(), 0, length);
00095 }
00096 catch (qgxml::SAXException& se) {
00097 throw xercesc::SAXException(se.getMessage());
00098 }
00099 }
00100
00101
00102
00103 void
00104 XercesQgarContentHandlerAdaptor::endDocument()
00105 {
00106 try {
00107
00108 _impl->endDocument();
00109 }
00110 catch (qgxml::SAXException& se) {
00111 throw xercesc::SAXException(se.getMessage());
00112 }
00113 }
00114
00115
00116
00117 void
00118 XercesQgarContentHandlerAdaptor::endElement(const XMLCh * const uri,
00119 const XMLCh * const localname,
00120 const XMLCh * const qName)
00121 {
00122 try {
00123
00124 _impl->endElement(_sc(uri), _sc(localname), _sc(qName));
00125 }
00126 catch (qgxml::SAXException& se) {
00127 throw xercesc::SAXException(se.getMessage());
00128 }
00129 }
00130
00131
00132
00133 void
00134 XercesQgarContentHandlerAdaptor::ignorableWhitespace(const XMLCh * const chars,
00135 const unsigned
00136 int length)
00137 {
00138 try {
00139
00140 _impl->ignorableWhitespace(_sc(chars).c_str(), 0, length);
00141 }
00142 catch (qgxml::SAXException& se) {
00143 throw xercesc::SAXException(se.getMessage());
00144 }
00145 }
00146
00147
00148
00149 void
00150 XercesQgarContentHandlerAdaptor::processingInstruction(const XMLCh * const target,
00151 const XMLCh * const data)
00152 {
00153 try {
00154
00155 _impl->processingInstruction(_sc(target), _sc(data));
00156 }
00157 catch (qgxml::SAXException& se) {
00158 throw xercesc::SAXException(se.getMessage());
00159 }
00160 }
00161
00162
00163
00164 void
00165 XercesQgarContentHandlerAdaptor::setDocumentLocator(
00166 const xercesc::Locator * const locator
00167 )
00168 {
00169
00170
00171 delete _locatorImpl;
00172 _locatorImpl = new XercesLocatorAdaptor(const_cast<xercesc::Locator *>(locator));
00173
00174
00175
00176
00177 _impl->setDocumentLocator(_locatorImpl);
00178
00179 }
00180
00181
00182
00183 void
00184 XercesQgarContentHandlerAdaptor::startDocument()
00185 {
00186 try {
00187
00188 _impl->startDocument();
00189 }
00190 catch (qgxml::SAXException& se) {
00191 throw xercesc::SAXException(se.getMessage());
00192 }
00193 }
00194
00195
00196
00197 void
00198 XercesQgarContentHandlerAdaptor::startElement(const XMLCh * const uri,
00199 const XMLCh * const localname,
00200 const XMLCh * const qname,
00201 const xercesc::Attributes & attrs)
00202 {
00203 try {
00204
00205 _impl->startElement(_sc(uri),
00206 _sc(localname),
00207 _sc(qname),
00208 XercesAttributesAdaptor(
00209 const_cast<xercesc::Attributes *>(&attrs))
00210 );
00211 }
00212 catch (qgxml::SAXException& se) {
00213 throw xercesc::SAXException(se.getMessage());
00214 }
00215 }
00216
00217
00218
00219 void
00220 XercesQgarContentHandlerAdaptor::startPrefixMapping(const XMLCh * const prefix,
00221 const XMLCh * const uri)
00222 {
00223 try {
00224
00225 _impl->startPrefixMapping(_sc(prefix), _sc(uri));
00226 }
00227 catch (qgxml::SAXException& se) {
00228 throw xercesc::SAXException(se.getMessage());
00229 }
00230 }
00231
00232
00233
00234 void
00235 XercesQgarContentHandlerAdaptor::endPrefixMapping(const XMLCh * const prefix)
00236 {
00237 try {
00238
00239 _impl->endPrefixMapping(_sc(prefix));
00240 }
00241 catch (qgxml::SAXException& se) {
00242 throw xercesc::SAXException(se.getMessage());
00243 }
00244 }
00245
00246
00247
00248 void
00249 XercesQgarContentHandlerAdaptor::skippedEntity(const XMLCh * name)
00250 {
00251 try {
00252
00253 _impl->skippedEntity(_sc(name));
00254 }
00255 catch (qgxml::SAXException& se) {
00256 throw xercesc::SAXException(se.getMessage());
00257 }
00258 }
00259
00260
00261
00262 }