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