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 23 of file DDLSAX2ConfigHandler.cc.

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

Definition at line 31 of file DDLSAX2ConfigHandler.cc.

32 {}

Member Function Documentation

const bool DDLSAX2ConfigHandler::doValidation ( void  ) const

Definition at line 140 of file DDLSAX2ConfigHandler.cc.

References doValidation_.

Referenced by FIPConfiguration::doValidation().

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

Definition at line 122 of file DDLSAX2ConfigHandler.cc.

References files_.

Referenced by FIPConfiguration::readConfig().

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

Definition at line 134 of file DDLSAX2ConfigHandler.cc.

References schemaLocation_.

Referenced by FIPConfiguration::getSchemaLocation().

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

Definition at line 128 of file DDLSAX2ConfigHandler.cc.

References urls_.

Referenced by FIPConfiguration::readConfig().

129 {
130  return urls_;
131 }
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 47 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(), relmon_authenticated_wget::url, and urls_.

51 {
52 
53  ++elementCount_;
54  attrCount_ += attrs.getLength();
55 
56  std::string myelemname(StrX(qname).localForm());
57  DCOUT_V('P', "DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement" << myelemname << " started...");
58 
59  unsigned int numAtts = attrs.getLength();
60  unsigned int i = 0;
61  if (myelemname == "File")
62  {
63  std::string name="", url="";
64  while ( i < numAtts )
65  {
66  std::string myattname(StrX(attrs.getLocalName(i)).localForm());
67  std::string myvalue(StrX(attrs.getValue(i)).localForm());
68 
69  if (myattname == "name")
70  name=myvalue;
71  if (myattname == "url")
72  url=myvalue;
73  ++i;
74  }
75  DCOUT('P', "file name = " << name << " and url = " << url);
76  files_.push_back(name);
77  urls_.push_back(url);
78  }
79  else if (myelemname == "Root")
80  {
81  std::string fileName="", logicalPartName="";
82  while ( i < numAtts )
83  {
84  std::string myattname(StrX(attrs.getLocalName(i)).localForm());
85  std::string myvalue(StrX(attrs.getValue(i)).localForm());
86 
87  if (myattname == "fileName")
88  fileName = myvalue;
89  if (myattname == "logicalPartName")
90  logicalPartName = myvalue;
91  ++i;
92  }
93 
94  fileName = fileName.substr(0, fileName.find("."));
95  // std::cout << fileName << ":" << logicalPartName << " is the ROOT" << std::endl;
96  DDLogicalPart root(DDName(logicalPartName,fileName));
97  DDRootDef::instance().set(root);//DDName(logicalPartName, fileName));
99  // DDCompactView cpv;
100  //DDName rt(DDName(logicalPartName, fileName));
101  cpv_.setRoot(root);
102  DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement. Setting DDRoot LogicalPart=") + logicalPartName + std::string(" in ") + fileName);
103 
104  }
105  else if (myelemname == "Schema")
106  {
107  while ( i < numAtts )
108  {
109  std::string myattname(StrX(attrs.getLocalName(i)).localForm());
110  std::string myvalue(StrX(attrs.getValue(i)).localForm());
111  if (myattname == "schemaLocation")
112  schemaLocation_ = myvalue;
113  else if (myattname == "validation")
114  doValidation_ = (myvalue == "true" ? true : false);
115  ++i;
116  }
117  }
118  // std::cout << "DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement " << myelemname << " completed..." << std::endl;
119 }
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:88
#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().