CMS 3D CMS Logo

DDLSAX2ExpressionHandler.cc

Go to the documentation of this file.
00001 /***************************************************************************
00002                           DDLSAX2ExpressionHandler.cc  -  description
00003                              -------------------
00004     begin                : Mon Feb 25, 2002
00005     email                : case@ucdhep.ucdavis.edu
00006  ***************************************************************************/
00007 
00008 /***************************************************************************
00009  *                                                                         *
00010  *           DDDParser sub-component of DDD                                *
00011  *                                                                         *
00012  ***************************************************************************/
00013 
00014 // ---------------------------------------------------------------------------
00015 //  Includes
00016 // ---------------------------------------------------------------------------
00017 #include "DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler.h"
00018 #include "DetectorDescription/Parser/interface/DDLParser.h"
00019 #include "StrX.h"
00020 
00021 // DDCore dependencies
00022 #include "DetectorDescription/Base/interface/DDdebug.h"
00023 
00024 #include "DetectorDescription/ExprAlgo/interface/ExprEvalSingleton.h"
00025 
00026 // Xerces C++ dependencies
00027 #include <xercesc/sax2/Attributes.hpp>
00028 #include <xercesc/sax/SAXParseException.hpp>
00029 #include <xercesc/sax/SAXException.hpp>
00030 
00031 // Seal timer
00032 //#include "SealUtil/SealTimer.h"
00033 
00034 
00035 #include <iostream>
00036 #include <vector>
00037 #include <string>
00038 
00039 // ---------------------------------------------------------------------------
00040 //  DDLSAX2Handler: Constructors and Destructor
00041 // ---------------------------------------------------------------------------
00042 DDLSAX2ExpressionHandler::DDLSAX2ExpressionHandler() // : inConstantsSection_(false)
00043 {
00044 }
00045 
00046 DDLSAX2ExpressionHandler::~DDLSAX2ExpressionHandler()
00047 {
00048 }
00049 
00050 // This does most of the work, it sets and determines whether it is 
00051 // in a ConstantsSection element, and if so, to process all the 
00052 // constants accordingly.
00053 void DDLSAX2ExpressionHandler::startElement(const XMLCh* const uri
00054                                    , const XMLCh* const localname
00055                                    , const XMLCh* const qname
00056                                    , const Attributes& attrs)
00057 {
00058   //  static seal::SealTimer tdseh("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler::startElement(..)", false);
00059   
00060   ++elementCount_;
00061   attrCount_ += attrs.getLength();
00062 
00063   pElementName = StrX(qname).localForm();
00064 
00065   if (pElementName == "Constant") 
00066     {
00067       ++elementTypeCounter_[pElementName];
00068       DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: start ") + pElementName);
00069       unsigned int numAtts = attrs.getLength();
00070       std::string varName, varValue;
00071       for (unsigned int i = 0; i < numAtts; ++i)
00072         {
00073           std::string myattname(StrX(attrs.getLocalName(i)).localForm());
00074           std::string myvalue(StrX(attrs.getValue(i)).localForm());
00075 
00076           std::string myQName(StrX(attrs.getQName(i)).localForm());
00077           DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: ") + "getLocalName = " + myattname + "  getValue = " +  myvalue + "   getQName = " + myQName);
00078 
00079           // attributes unit and quantity are not used right now.
00080           if (myattname == "name")
00081             varName = myvalue;
00082           else if (myattname == "value")
00083             varValue = myvalue;
00084         }
00085       DDLParser* beingParsed = DDLParser::instance();
00086       std::string nmspace = getnmspace(extractFileName( beingParsed->getCurrFileName()));
00087       ExprEvalInterface & ev = ExprEvalSingleton::instance();
00088       ev.set(nmspace, varName, varValue);
00089     }
00090 }
00091 
00092 void DDLSAX2ExpressionHandler::endElement(const XMLCh* const uri
00093                                     , const XMLCh* const localname
00094                                     , const XMLCh* const qname)
00095 {
00096 
00097 }
00098 

Generated on Tue Jun 9 17:32:24 2009 for CMSSW by  doxygen 1.5.4