Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler.h"
00015 #include "DetectorDescription/Parser/src/StrX.h"
00016
00017 #include "DetectorDescription/Base/interface/DDdebug.h"
00018
00019 #include "DetectorDescription/ExprAlgo/interface/ExprEvalSingleton.h"
00020
00021 #include <iostream>
00022 #include <vector>
00023 #include <string>
00024
00025
00026
00027
00028 DDLSAX2ExpressionHandler::DDLSAX2ExpressionHandler( DDCompactView& cpv )
00029 : DDLSAX2FileHandler::DDLSAX2FileHandler( cpv )
00030 {}
00031
00032 DDLSAX2ExpressionHandler::~DDLSAX2ExpressionHandler( void )
00033 {}
00034
00035
00036
00037
00038 void
00039 DDLSAX2ExpressionHandler::startElement( const XMLCh* const uri,
00040 const XMLCh* const localname,
00041 const XMLCh* const qname,
00042 const Attributes& attrs )
00043 {
00044 ++elementCount_;
00045 attrCount_ += attrs.getLength();
00046
00047 pElementName = StrX(qname).localForm();
00048
00049 if (pElementName == "Constant")
00050 {
00051 ++elementTypeCounter_[pElementName];
00052 DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: start ") + pElementName);
00053 unsigned int numAtts = attrs.getLength();
00054 std::string varName, varValue;
00055 for (unsigned int i = 0; i < numAtts; ++i)
00056 {
00057 std::string myattname(StrX(attrs.getLocalName(i)).localForm());
00058 std::string myvalue(StrX(attrs.getValue(i)).localForm());
00059
00060 std::string myQName(StrX(attrs.getQName(i)).localForm());
00061 DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: ") + "getLocalName = " + myattname + " getValue = " + myvalue + " getQName = " + myQName);
00062
00063
00064 if (myattname == "name")
00065 varName = myvalue;
00066 else if (myattname == "value")
00067 varValue = myvalue;
00068 }
00069
00070
00071 ExprEvalInterface & ev = ExprEvalSingleton::instance();
00072 ev.set(nmspace_, varName, varValue);
00073 }
00074 }
00075
00076 void
00077 DDLSAX2ExpressionHandler::endElement( const XMLCh* const uri,
00078 const XMLCh* const localname,
00079 const XMLCh* const qname )
00080 {}