CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DDLSAX2ConfigHandler Class Reference

DDLSAX2ConfigHandler is the handler for the configuration file. More...

#include <DDLSAX2ConfigHandler.h>

Inheritance diagram for DDLSAX2ConfigHandler:
DDLSAX2Handler

Public Member Functions

 DDLSAX2ConfigHandler (DDCompactView &cpv)
 
const bool doValidation () const
 
const std::vector< std::string > & getFileNames () const
 
const std::string getSchemaLocation () const
 
const std::vector< std::string > & getURLs () const
 
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
 
 ~DDLSAX2ConfigHandler ()
 
- Public Member Functions inherited from DDLSAX2Handler
virtual void characters (const XMLCh *const chars, const unsigned int length)
 
virtual void comment (const XMLCh *const chars, const unsigned int length)
 
 DDLSAX2Handler ()
 
virtual void dumpStats (const std::string &fname)
 
virtual void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
 
virtual void error (const SAXParseException &exception)
 
virtual void fatalError (const SAXParseException &exception)
 
unsigned int getAttrCount () const
 Get the count of attributes processed so far. More...
 
unsigned int getCharacterCount () const
 Get the count of characters processed so far. More...
 
unsigned int getElementCount () const
 Get the count of elements processed so far. More...
 
bool getSawErrors () const
 Did the XML parser see any errors? More...
 
unsigned int getSpaceCount () const
 Get the count of spaces processed so far. More...
 
virtual void ignorableWhitespace (const XMLCh *const chars, const unsigned int length)
 
virtual void resetDocument ()
 
virtual void setNameSpace (const std::string &nms)
 
virtual void setUserNS (bool userns)
 
virtual void warning (const SAXParseException &exception)
 
 ~DDLSAX2Handler ()
 

Private Attributes

DDCompactViewcpv_
 
bool doValidation_
 
std::vector< std::string > files_
 
std::string schemaLocation_
 
std::vector< std::string > urls_
 

Additional Inherited Members

- Public Types inherited from DDLSAX2Handler
typedef
XERCES_CPP_NAMESPACE::Attributes 
Attributes
 
typedef
XERCES_CPP_NAMESPACE::SAXParseException 
SAXParseException
 
- Protected Attributes inherited from DDLSAX2Handler
unsigned int attrCount_
 
unsigned int characterCount_
 
unsigned int elementCount_
 
std::string nmspace_
 
bool sawErrors_
 
unsigned int spaceCount_
 
bool userNS_
 

Detailed Description

DDLSAX2ConfigHandler is the handler for the configuration file.

Author
Michael Case

DDLSAX2ConfigHandler.h - description

begin: Mon Oct 22 2001 email: case@.nosp@m.ucdh.nosp@m.ep.uc.nosp@m.davi.nosp@m.s.edu

This handler is used by the DDLParser to process configuration files.

Definition at line 30 of file DDLSAX2ConfigHandler.h.

Constructor & Destructor Documentation

DDLSAX2ConfigHandler::DDLSAX2ConfigHandler ( DDCompactView cpv)

Definition at line 24 of file DDLSAX2ConfigHandler.cc.

25  : doValidation_(false),
26  files_(),
27  urls_(),
29  cpv_(cpv)
30 {}
std::vector< std::string > files_
std::vector< std::string > urls_
DDLSAX2ConfigHandler::~DDLSAX2ConfigHandler ( void  )

Definition at line 32 of file DDLSAX2ConfigHandler.cc.

33 {}

Member Function Documentation

const bool DDLSAX2ConfigHandler::doValidation ( void  ) const

Definition at line 141 of file DDLSAX2ConfigHandler.cc.

References doValidation_.

Referenced by FIPConfiguration::doValidation().

142 {
143  return doValidation_;
144 }
const std::vector< std::string > & DDLSAX2ConfigHandler::getFileNames ( void  ) const

Definition at line 123 of file DDLSAX2ConfigHandler.cc.

References files_.

Referenced by FIPConfiguration::readConfig().

124 {
125  return files_;
126 }
std::vector< std::string > files_
const std::string DDLSAX2ConfigHandler::getSchemaLocation ( void  ) const

Definition at line 135 of file DDLSAX2ConfigHandler.cc.

References schemaLocation_.

Referenced by FIPConfiguration::getSchemaLocation().

136 {
137  return schemaLocation_;
138 }
const std::vector< std::string > & DDLSAX2ConfigHandler::getURLs ( void  ) const

Definition at line 129 of file DDLSAX2ConfigHandler.cc.

References urls_.

Referenced by FIPConfiguration::readConfig().

130 {
131  return urls_;
132 }
std::vector< std::string > urls_
void DDLSAX2ConfigHandler::startElement ( const XMLCh *const  uri,
const XMLCh *const  localname,
const XMLCh *const  qname,
const Attributes attrs 
)
virtual

bad, just testing...

Reimplemented from DDLSAX2Handler.

Definition at line 48 of file DDLSAX2ConfigHandler.cc.

References DDLSAX2Handler::attrCount_, cpv_, DCOUT, DCOUT_V, doValidation_, DDLSAX2Handler::elementCount_, convertXMLtoSQLite_cfg::fileName, files_, i, DDI::Singleton< I >::instance(), mergeVDriftHistosByStation::name, dbtoconf::root, schemaLocation_, DDCompactView::setRoot(), and urls_.

52 {
53 
54  ++elementCount_;
55  attrCount_ += attrs.getLength();
56 
57  std::string myelemname(StrX(qname).localForm());
58  DCOUT_V('P', "DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement" << myelemname << " started...");
59 
60  unsigned int numAtts = attrs.getLength();
61  unsigned int i = 0;
62  if (myelemname == "File")
63  {
64  std::string name="", url="";
65  while ( i < numAtts )
66  {
67  std::string myattname(StrX(attrs.getLocalName(i)).localForm());
68  std::string myvalue(StrX(attrs.getValue(i)).localForm());
69 
70  if (myattname == "name")
71  name=myvalue;
72  if (myattname == "url")
73  url=myvalue;
74  ++i;
75  }
76  DCOUT('P', "file name = " << name << " and url = " << url);
77  files_.push_back(name);
78  urls_.push_back(url);
79  }
80  else if (myelemname == "Root")
81  {
82  std::string fileName="", logicalPartName="";
83  while ( i < numAtts )
84  {
85  std::string myattname(StrX(attrs.getLocalName(i)).localForm());
86  std::string myvalue(StrX(attrs.getValue(i)).localForm());
87 
88  if (myattname == "fileName")
89  fileName = myvalue;
90  if (myattname == "logicalPartName")
91  logicalPartName = myvalue;
92  ++i;
93  }
94 
95  fileName = fileName.substr(0, fileName.find("."));
96  // std::cout << fileName << ":" << logicalPartName << " is the ROOT" << std::endl;
97  DDLogicalPart root(DDName(logicalPartName,fileName));
98  DDRootDef::instance().set(root);//DDName(logicalPartName, fileName));
100  // DDCompactView cpv;
101  //DDName rt(DDName(logicalPartName, fileName));
102  cpv_.setRoot(root);
103  DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement. Setting DDRoot LogicalPart=") + logicalPartName + std::string(" in ") + fileName);
104 
105  }
106  else if (myelemname == "Schema")
107  {
108  while ( i < numAtts )
109  {
110  std::string myattname(StrX(attrs.getLocalName(i)).localForm());
111  std::string myvalue(StrX(attrs.getValue(i)).localForm());
112  if (myattname == "schemaLocation")
113  schemaLocation_ = myvalue;
114  else if (myattname == "validation")
115  doValidation_ = (myvalue == "true" ? true : false);
116  ++i;
117  }
118  }
119  // std::cout << "DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement " << myelemname << " completed..." << std::endl;
120 }
int i
Definition: DBlmapReader.cc:9
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
std::vector< std::string > files_
unsigned int elementCount_
void setRoot(const DDLogicalPart &root)
don&#39;t use : interface not stable ....
static value_type & instance()
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:95
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
std::vector< std::string > urls_
def qname
Definition: asciidump.py:315
Definition: StrX.h:32
unsigned int attrCount_
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
string root
initialization
Definition: dbtoconf.py:70

Member Data Documentation

DDCompactView& DDLSAX2ConfigHandler::cpv_
private

Definition at line 57 of file DDLSAX2ConfigHandler.h.

Referenced by startElement().

bool DDLSAX2ConfigHandler::doValidation_
private

Definition at line 53 of file DDLSAX2ConfigHandler.h.

Referenced by doValidation(), and startElement().

std::vector<std::string> DDLSAX2ConfigHandler::files_
private

Definition at line 54 of file DDLSAX2ConfigHandler.h.

Referenced by getFileNames(), and startElement().

std::string DDLSAX2ConfigHandler::schemaLocation_
private

Definition at line 56 of file DDLSAX2ConfigHandler.h.

Referenced by getSchemaLocation(), and startElement().

std::vector<std::string> DDLSAX2ConfigHandler::urls_
private

Definition at line 55 of file DDLSAX2ConfigHandler.h.

Referenced by getURLs(), and startElement().