CMS 3D CMS Logo

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

List of all members.

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 ()

Private Attributes

std::string pElementName

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@ucdhep.ucdavis.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)
DDLSAX2ExpressionHandler::~DDLSAX2ExpressionHandler ( void  )

Definition at line 32 of file DDLSAX2ExpressionHandler.cc.

{}

Member Function Documentation

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

Reimplemented from DDLSAX2FileHandler.

Definition at line 77 of file DDLSAX2ExpressionHandler.cc.

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

Reimplemented from DDLSAX2FileHandler.

Definition at line 39 of file DDLSAX2ExpressionHandler.cc.

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

{
  ++elementCount_;
  attrCount_ += attrs.getLength();

  pElementName = StrX(qname).localForm();

  if (pElementName == "Constant") 
  {
    ++elementTypeCounter_[pElementName];
    DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: start ") + pElementName);
    unsigned int numAtts = attrs.getLength();
    std::string varName, varValue;
    for (unsigned int i = 0; i < numAtts; ++i)
    {
      std::string myattname(StrX(attrs.getLocalName(i)).localForm());
      std::string myvalue(StrX(attrs.getValue(i)).localForm());

      std::string myQName(StrX(attrs.getQName(i)).localForm());
      DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: ") + "getLocalName = " + myattname + "  getValue = " +  myvalue + "   getQName = " + myQName);

      // attributes unit and quantity are not used right now.
      if (myattname == "name")
        varName = myvalue;
      else if (myattname == "value")
        varValue = myvalue;
    }
    //      DDLParser* beingParsed = DDLParser::instance();
    //      std::string nmspace = getnmspace(extractFileName( beingParsed->getCurrFileName()));
    ExprEvalInterface & ev = ExprEvalSingleton::instance();
    ev.set(nmspace_, varName, varValue);
  }
}

Member Data Documentation

Definition at line 48 of file DDLSAX2ExpressionHandler.h.

Referenced by startElement().