CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDLSAX2ExpressionHandler.cc
Go to the documentation of this file.
1 /***************************************************************************
2  DDLSAX2ExpressionHandler.cc - description
3  -------------------
4  begin : Mon Feb 25, 2002
5  email : case@ucdhep.ucdavis.edu
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * DDDParser sub-component of DDD *
11  * *
12  ***************************************************************************/
13 
16 
18 
20 
21 #include <iostream>
22 #include <vector>
23 #include <string>
24 
25 // ---------------------------------------------------------------------------
26 // DDLSAX2Handler: Constructors and Destructor
27 // ---------------------------------------------------------------------------
30 {}
31 
33 {}
34 
35 // This does most of the work, it sets and determines whether it is
36 // in a ConstantsSection element, and if so, to process all the
37 // constants accordingly.
38 void
40  const XMLCh* const localname,
41  const XMLCh* const qname,
42  const Attributes& attrs )
43 {
44  ++elementCount_;
45  attrCount_ += attrs.getLength();
46 
47  pElementName = StrX(qname).localForm();
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 }
75 
76 void
77 DDLSAX2ExpressionHandler::endElement( const XMLCh* const uri,
78  const XMLCh* const localname,
79  const XMLCh* const qname )
80 {}
int i
Definition: DBlmapReader.cc:9
DDLSAX2ExpressionHandler(DDCompactView &cpv)
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
type of data representation of DDCompactView
Definition: DDCompactView.h:77
unsigned int elementCount_
DDLSAX2FileHandler is the SAX2 Handler for XML files found in the configuration file.
static value_type & instance()
Interface of an Expression Evaluator.
std::string nmspace_
const char * localForm() const
Definition: StrX.h:66
void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
def qname
Definition: asciidump.py:315
std::map< std::string, int > elementTypeCounter_
Definition: StrX.h:32
unsigned int attrCount_
XERCES_CPP_NAMESPACE::Attributes Attributes