CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DDLSAX2ExpressionHandler Class Reference

DDLSAX2ExpressionHandler is the first pass SAX2 Handler for XML files found in the configuration file. More...

#include <DDLSAX2ExpressionHandler.h>

Inheritance diagram for DDLSAX2ExpressionHandler:
DDLSAX2FileHandler DDLSAX2Handler

Public Member Functions

 DDLSAX2ExpressionHandler (DDCompactView &cpv)
 
void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
 
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
 
 ~DDLSAX2ExpressionHandler ()
 
- Public Member Functions inherited from DDLSAX2FileHandler
void characters (const XMLCh *const chars, const unsigned int length)
 
void comment (const XMLCh *const chars, const unsigned int length)
 
 DDLSAX2FileHandler (DDCompactView &cpv)
 
void dumpElementTypeCounter ()
 This dumps some statistics on elements encountered in the file. More...
 
void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
 
void init ()
 
virtual const std::string & parent () const
 
virtual const std::string & self () const
 
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
 
 ~DDLSAX2FileHandler ()
 
- Public Member Functions inherited from DDLSAX2Handler
 DDLSAX2Handler ()
 
virtual void dumpStats (const std::string &fname)
 
virtual void error (const SAXParseException &exception)
 
virtual void fatalError (const SAXParseException &exception)
 
unsigned int getAttrCount () const
 Get the count of attributes processed so far. More...
 
unsigned int getCharacterCount () const
 Get the count of characters processed so far. More...
 
unsigned int getElementCount () const
 Get the count of elements processed so far. More...
 
bool getSawErrors () const
 Did the XML parser see any errors? More...
 
unsigned int getSpaceCount () const
 Get the count of spaces processed so far. More...
 
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 warning (const SAXParseException &exception)
 
 ~DDLSAX2Handler ()
 

Private Attributes

std::string pElementName
 

Additional Inherited Members

- Public Types inherited from DDLSAX2Handler
typedef
XERCES_CPP_NAMESPACE::Attributes 
Attributes
 
typedef
XERCES_CPP_NAMESPACE::SAXParseException 
SAXParseException
 
- Protected Member Functions inherited from DDLSAX2FileHandler
void createDDConstants () const
 creates all DDConstant from the evaluator which has been already 'filled' in the first scan of the documents More...
 
- Protected Attributes inherited from DDLSAX2FileHandler
DDCompactViewcpv_
 
std::map< std::string, int > elementTypeCounter_
 
std::vector< size_t > names_
 
std::vector< std::string > namesMap_
 
DDLElementRegistry xmlelems_
 
- Protected Attributes inherited from DDLSAX2Handler
unsigned int attrCount_
 
unsigned int characterCount_
 
unsigned int elementCount_
 
std::string nmspace_
 
bool sawErrors_
 
unsigned int spaceCount_
 
bool userNS_
 

Detailed Description

DDLSAX2ExpressionHandler is the first pass SAX2 Handler for XML files found in the configuration file.

Author
Michael Case

DDLSAX2ExpressionHandler.h - description

begin: Mon Feb 25, 2002 email: case@.nosp@m.ucdh.nosp@m.ep.uc.nosp@m.davi.nosp@m.s.edu

This processes only ConstantsSection/Parameter elements so there is no need to make it as elaborate as the second pass parser.

Definition at line 26 of file DDLSAX2ExpressionHandler.h.

Constructor & Destructor Documentation

DDLSAX2ExpressionHandler::DDLSAX2ExpressionHandler ( DDCompactView cpv)

Definition at line 28 of file DDLSAX2ExpressionHandler.cc.

30 {}
DDLSAX2FileHandler(DDCompactView &cpv)
DDLSAX2ExpressionHandler::~DDLSAX2ExpressionHandler ( void  )

Definition at line 32 of file DDLSAX2ExpressionHandler.cc.

33 {}

Member Function Documentation

void DDLSAX2ExpressionHandler::endElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname 
)
virtual

Reimplemented from DDLSAX2Handler.

Definition at line 77 of file DDLSAX2ExpressionHandler.cc.

80 {}
void DDLSAX2ExpressionHandler::startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const Attributes attrs 
)
virtual

Reimplemented from DDLSAX2Handler.

Definition at line 39 of file DDLSAX2ExpressionHandler.cc.

References DDLSAX2Handler::attrCount_, DCOUT_V, DDLSAX2Handler::elementCount_, DDLSAX2FileHandler::elementTypeCounter_, i, DDI::Singleton< I >::instance(), StrX::localForm(), DDLSAX2Handler::nmspace_, pElementName, and ExprEvalInterface::set().

43 {
44  ++elementCount_;
45  attrCount_ += attrs.getLength();
46 
48 
49  if (pElementName == "Constant")
50  {
52  DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: start ") + pElementName);
53  unsigned int numAtts = attrs.getLength();
54  std::string varName, varValue;
55  for (unsigned int i = 0; i < numAtts; ++i)
56  {
57  std::string myattname(StrX(attrs.getLocalName(i)).localForm());
58  std::string myvalue(StrX(attrs.getValue(i)).localForm());
59 
60  std::string myQName(StrX(attrs.getQName(i)).localForm());
61  DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: ") + "getLocalName = " + myattname + " getValue = " + myvalue + " getQName = " + myQName);
62 
63  // attributes unit and quantity are not used right now.
64  if (myattname == "name")
65  varName = myvalue;
66  else if (myattname == "value")
67  varValue = myvalue;
68  }
69  // DDLParser* beingParsed = DDLParser::instance();
70  // std::string nmspace = getnmspace(extractFileName( beingParsed->getCurrFileName()));
72  ev.set(nmspace_, varName, varValue);
73  }
74 }
int i
Definition: DBlmapReader.cc:9
virtual void set(const std::string &ns, const std::string &name, const std::string &valueExpr)=0
put a new variable named &#39;namespace:name&#39; into the dictionary of the evaluator
unsigned int elementCount_
static value_type & instance()
Interface of an Expression Evaluator.
std::string nmspace_
const char * localForm() const
Definition: StrX.h:66
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
def qname
Definition: asciidump.py:315
std::map< std::string, int > elementTypeCounter_
Definition: StrX.h:32
unsigned int attrCount_

Member Data Documentation

std::string DDLSAX2ExpressionHandler::pElementName
private

Definition at line 48 of file DDLSAX2ExpressionHandler.h.

Referenced by startElement().