CMS 3D CMS Logo

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

List of all members.

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 ()

Private Attributes

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

Detailed Description

DDLSAX2ConfigHandler is the handler for the configuration file.

Author:
Michael Case

DDLSAX2ConfigHandler.h - description ------------------- begin: Mon Oct 22 2001 email: case@ucdhep.ucdavis.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.

  : doValidation_(false),
    files_(),
    urls_(),
    schemaLocation_(),
    cpv_(cpv)
{}
DDLSAX2ConfigHandler::~DDLSAX2ConfigHandler ( void  )

Definition at line 31 of file DDLSAX2ConfigHandler.cc.

{}

Member Function Documentation

const bool DDLSAX2ConfigHandler::doValidation ( void  ) const

Definition at line 140 of file DDLSAX2ConfigHandler.cc.

References doValidation_.

Referenced by FIPConfiguration::doValidation().

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

Definition at line 122 of file DDLSAX2ConfigHandler.cc.

References files_.

Referenced by FIPConfiguration::readConfig().

{
  return files_;
}
const std::string DDLSAX2ConfigHandler::getSchemaLocation ( void  ) const

Definition at line 134 of file DDLSAX2ConfigHandler.cc.

References schemaLocation_.

Referenced by FIPConfiguration::getSchemaLocation().

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

Definition at line 128 of file DDLSAX2ConfigHandler.cc.

References urls_.

Referenced by FIPConfiguration::readConfig().

{
  return 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, instance, mergeVDriftHistosByStation::name, dbtoconf::root, schemaLocation_, DDCompactView::setRoot(), and urls_.

{

  ++elementCount_;
  attrCount_ += attrs.getLength();

  std::string myelemname(StrX(qname).localForm());
  DCOUT_V('P', "DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement" << myelemname << " started...");

  unsigned int numAtts = attrs.getLength();
  unsigned int i = 0;
  if (myelemname == "File")
  {
    std::string name="", url="";
    while ( i < numAtts )
    {
      std::string myattname(StrX(attrs.getLocalName(i)).localForm());
      std::string myvalue(StrX(attrs.getValue(i)).localForm());

      if (myattname == "name")
        name=myvalue;
      if (myattname == "url")
        url=myvalue;
      ++i;
    }
    DCOUT('P', "file name = " << name << " and url = " << url);
    files_.push_back(name);
    urls_.push_back(url);
  }
  else if (myelemname == "Root")
  {
    std::string fileName="", logicalPartName="";
    while ( i < numAtts )
    {
      std::string myattname(StrX(attrs.getLocalName(i)).localForm());
      std::string myvalue(StrX(attrs.getValue(i)).localForm());

      if (myattname == "fileName")
        fileName = myvalue;
      if (myattname == "logicalPartName")
        logicalPartName = myvalue;
      ++i;
    }

    fileName = fileName.substr(0, fileName.find("."));
    //      std::cout << fileName << ":" << logicalPartName << " is the ROOT" << std::endl;
    DDLogicalPart root(DDName(logicalPartName,fileName));
    DDRootDef::instance().set(root);//DDName(logicalPartName, fileName));
    //      DDCompactView cpv;
    //DDName rt(DDName(logicalPartName, fileName));
    cpv_.setRoot(root);
    DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement.  Setting DDRoot LogicalPart=") + logicalPartName + std::string(" in ") + fileName);  

  }
  else if (myelemname == "Schema")
  {
    while ( i < numAtts )
    {
      std::string myattname(StrX(attrs.getLocalName(i)).localForm());
      std::string myvalue(StrX(attrs.getValue(i)).localForm());
      if (myattname == "schemaLocation")
        schemaLocation_ = myvalue;
      else if (myattname == "validation")
        doValidation_ = (myvalue == "true" ? true : false);
      ++i;
    }
  }
  //  std::cout <<  "DetectorDescription/Parser/interface/DDLSAX2ConfigHandler::startElement " << myelemname << " completed..." << std::endl;
}

Member Data Documentation

Definition at line 57 of file DDLSAX2ConfigHandler.h.

Referenced by startElement().

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().

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().