DDLSAX2Handler inherits from Xerces C++ DefaultHandler. More...
#include <DDLSAX2Handler.h>
Public Types | |
typedef XERCES_CPP_NAMESPACE::Attributes | Attributes |
typedef XERCES_CPP_NAMESPACE::SAXParseException | SAXParseException |
Public Member Functions | |
virtual void | characters (const XMLCh *const chars, const unsigned int length) |
virtual void | comment (const XMLCh *const chars, const unsigned int length) |
DDLSAX2Handler () | |
virtual void | dumpStats (const std::string &fname) |
virtual void | endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname) |
virtual void | error (const SAXParseException &exception) |
virtual void | fatalError (const SAXParseException &exception) |
unsigned int | getAttrCount () const |
Get the count of attributes processed so far. | |
unsigned int | getCharacterCount () const |
Get the count of characters processed so far. | |
unsigned int | getElementCount () const |
Get the count of elements processed so far. | |
bool | getSawErrors () const |
Did the XML parser see any errors? | |
unsigned int | getSpaceCount () const |
Get the count of spaces processed so far. | |
virtual void | ignorableWhitespace (const XMLCh *const chars, const unsigned int length) |
virtual void | resetDocument () |
virtual void | setNameSpace (const std::string &nms) |
virtual void | setUserNS (bool userns) |
virtual void | startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs) |
virtual void | warning (const SAXParseException &exception) |
~DDLSAX2Handler () | |
Protected Attributes | |
unsigned int | attrCount_ |
unsigned int | characterCount_ |
unsigned int | elementCount_ |
std::string | nmspace_ |
bool | sawErrors_ |
unsigned int | spaceCount_ |
bool | userNS_ |
DDLSAX2Handler inherits from Xerces C++ DefaultHandler.
DDLSAX2Handler.h - description ------------------- begin: Mon Oct 22 2001 email: case@ucdhep.ucdavis.edu
The DefaultHandler of Xerces C++ provides an interface to the SAX2 event driven processing of XML documents. It does so by providing methods which are redefined by the inheriting class (DDLSAX2Handler in this case) to provide the desired processing for each event.
In this case, we accumulate some statistics. This class does nothing with startElement and endElement events.
Definition at line 36 of file DDLSAX2Handler.h.
typedef XERCES_CPP_NAMESPACE::Attributes DDLSAX2Handler::Attributes |
Definition at line 40 of file DDLSAX2Handler.h.
typedef XERCES_CPP_NAMESPACE::SAXParseException DDLSAX2Handler::SAXParseException |
Definition at line 41 of file DDLSAX2Handler.h.
DDLSAX2Handler::DDLSAX2Handler | ( | void | ) |
Definition at line 19 of file DDLSAX2Handler.cc.
: attrCount_(0), characterCount_(0), elementCount_(0), spaceCount_(0), sawErrors_(false), userNS_(false) {}
DDLSAX2Handler::~DDLSAX2Handler | ( | void | ) |
Definition at line 28 of file DDLSAX2Handler.cc.
{}
void DDLSAX2Handler::characters | ( | const XMLCh *const | chars, |
const unsigned int | length | ||
) | [virtual] |
Reimplemented in DDLSAX2FileHandler.
Definition at line 54 of file DDLSAX2Handler.cc.
References characterCount_.
{ characterCount_ += length; }
void DDLSAX2Handler::comment | ( | const XMLCh *const | chars, |
const unsigned int | length | ||
) | [virtual] |
Reimplemented in DDLSAX2FileHandler.
Definition at line 61 of file DDLSAX2Handler.cc.
{
// do nothing default..
}
void DDLSAX2Handler::dumpStats | ( | const std::string & | fname | ) | [virtual] |
Definition at line 83 of file DDLSAX2Handler.cc.
References gather_cfg::cout, getAttrCount(), getCharacterCount(), getElementCount(), and getSpaceCount().
{ std::cout << "DetectorDescription/Parser/interface/DDLSAX2Handler::dumpStats, file: " << fname << " (" << getElementCount() << " elems, " << getAttrCount() << " attrs, " << getSpaceCount() << " spaces, " << getCharacterCount() << " chars)" << std::endl; }
void DDLSAX2Handler::endElement | ( | const XMLCh *const | uri, |
const XMLCh *const | localname, | ||
const XMLCh *const | qname | ||
) | [virtual] |
Reimplemented in DDLSAX2ExpressionHandler, and DDLSAX2FileHandler.
Definition at line 46 of file DDLSAX2Handler.cc.
{
// do nothing
}
void DDLSAX2Handler::error | ( | const SAXParseException & | exception | ) | [virtual] |
Definition at line 98 of file DDLSAX2Handler.cc.
References sawErrors_.
{ sawErrors_ = true; edm::LogError("DetectorDescription_Parser_DDLSAX2Handler") << "\nError at file " << StrX(e.getSystemId()) << ", line " << e.getLineNumber() << ", char " << e.getColumnNumber() << "\n Message: " << StrX(e.getMessage()) << std::endl; }
void DDLSAX2Handler::fatalError | ( | const SAXParseException & | exception | ) | [virtual] |
Definition at line 109 of file DDLSAX2Handler.cc.
References Exception, sawErrors_, and AlCaHLTBitMon_QueryRunRegistry::string.
{ sawErrors_ = true; edm::LogError("DetectorDescription_Parser_DDLSAX2Handler") << "\nFatal Error at file " << StrX(e.getSystemId()) << ", line " << e.getLineNumber() << ", char " << e.getColumnNumber() << "\n Message: " << StrX(e.getMessage()) << std::endl; throw cms::Exception("DDException") << "DetectorDescription_Parser_Unrecoverable_Error_from_Xerces: " << std::string(StrX(e.getMessage()).localForm()) << " file: " << std::string(StrX(e.getSystemId()).localForm()) << " line: " << e.getLineNumber() << " col: " << e.getColumnNumber(); }
unsigned int DDLSAX2Handler::getAttrCount | ( | ) | const [inline] |
Get the count of attributes processed so far.
Definition at line 60 of file DDLSAX2Handler.h.
References attrCount_.
Referenced by dumpStats().
{ return attrCount_; }
unsigned int DDLSAX2Handler::getCharacterCount | ( | ) | const [inline] |
Get the count of characters processed so far.
Definition at line 65 of file DDLSAX2Handler.h.
References characterCount_.
Referenced by dumpStats().
{ return characterCount_; }
unsigned int DDLSAX2Handler::getElementCount | ( | ) | const [inline] |
Get the count of elements processed so far.
Definition at line 55 of file DDLSAX2Handler.h.
References elementCount_.
Referenced by dumpStats().
{ return elementCount_; }
bool DDLSAX2Handler::getSawErrors | ( | ) | const [inline] |
Did the XML parser see any errors?
Definition at line 70 of file DDLSAX2Handler.h.
References sawErrors_.
{ return sawErrors_; }
unsigned int DDLSAX2Handler::getSpaceCount | ( | ) | const [inline] |
Get the count of spaces processed so far.
Definition at line 75 of file DDLSAX2Handler.h.
References spaceCount_.
Referenced by dumpStats().
{ return spaceCount_; }
void DDLSAX2Handler::ignorableWhitespace | ( | const XMLCh *const | chars, |
const unsigned int | length | ||
) | [virtual] |
void DDLSAX2Handler::resetDocument | ( | void | ) | [virtual] |
Definition at line 74 of file DDLSAX2Handler.cc.
References attrCount_, characterCount_, elementCount_, and spaceCount_.
{ attrCount_ = 0; characterCount_ = 0; elementCount_ = 0; spaceCount_ = 0; }
void DDLSAX2Handler::setNameSpace | ( | const std::string & | nms | ) | [virtual] |
Definition at line 141 of file DDLSAX2Handler.cc.
References nmspace_.
Referenced by DDLParser::parse(), and DDLParser::parseOneFile().
{ nmspace_ = nms; }
void DDLSAX2Handler::setUserNS | ( | bool | userns | ) | [virtual] |
This allows the DDLSAX2Handler and objects that inherit from it to set the userNS_ flag to indicate false[default] use the filename of the file being handled as the DD namespace true assume ALL the "name" attributes have DD namespace specified.
Definition at line 135 of file DDLSAX2Handler.cc.
References userNS_.
Referenced by XMLIdealGeometryESSource::produce(), and XMLIdealGeometryESProducer::produce().
{ userNS_ = userns; }
void DDLSAX2Handler::startElement | ( | const XMLCh *const | uri, |
const XMLCh *const | localname, | ||
const XMLCh *const | qname, | ||
const Attributes & | attrs | ||
) | [virtual] |
Reimplemented in DDLSAX2ConfigHandler, DDLSAX2ExpressionHandler, and DDLSAX2FileHandler.
Definition at line 36 of file DDLSAX2Handler.cc.
References attrCount_, and elementCount_.
{ ++elementCount_; attrCount_ += attrs.getLength(); }
void DDLSAX2Handler::warning | ( | const SAXParseException & | exception | ) | [virtual] |
Definition at line 125 of file DDLSAX2Handler.cc.
unsigned int DDLSAX2Handler::attrCount_ [protected] |
Definition at line 117 of file DDLSAX2Handler.h.
Referenced by getAttrCount(), resetDocument(), startElement(), DDLSAX2ExpressionHandler::startElement(), and DDLSAX2ConfigHandler::startElement().
unsigned int DDLSAX2Handler::characterCount_ [protected] |
Definition at line 118 of file DDLSAX2Handler.h.
Referenced by characters(), getCharacterCount(), and resetDocument().
unsigned int DDLSAX2Handler::elementCount_ [protected] |
Definition at line 119 of file DDLSAX2Handler.h.
Referenced by getElementCount(), resetDocument(), startElement(), DDLSAX2ExpressionHandler::startElement(), and DDLSAX2ConfigHandler::startElement().
std::string DDLSAX2Handler::nmspace_ [protected] |
Definition at line 123 of file DDLSAX2Handler.h.
Referenced by DDLSAX2FileHandler::endElement(), setNameSpace(), DDLSAX2ExpressionHandler::startElement(), and DDLSAX2FileHandler::startElement().
bool DDLSAX2Handler::sawErrors_ [protected] |
Definition at line 121 of file DDLSAX2Handler.h.
Referenced by error(), fatalError(), and getSawErrors().
unsigned int DDLSAX2Handler::spaceCount_ [protected] |
Definition at line 120 of file DDLSAX2Handler.h.
Referenced by getSpaceCount(), ignorableWhitespace(), and resetDocument().
bool DDLSAX2Handler::userNS_ [protected] |
Definition at line 122 of file DDLSAX2Handler.h.
Referenced by DDLSAX2FileHandler::endElement(), and setUserNS().