CMS 3D CMS Logo

DDLSAX2ConfigHandler.cc
Go to the documentation of this file.
9 
10 #include <string>
11 #include <vector>
12 
13 using namespace cms::xerces;
14 
16  : doValidation_(false), files_(), urls_(), schemaLocation_(), cpv_(cpv) {}
17 
19 
20 // ---------------------------------------------------------------------------
21 // DDLSAX2Handler: Implementation of the SAX DocumentHandler interface
22 //
23 // This is kind-of sneaky-cheating. Basically it ignores all elements except
24 // File elements, and displays attributes up to the name attribute because that
25 // is the only one it cares about at this time. Later we would need a mechanism
26 // to exclude and include sections based on the configuration if we proceed with
27 // that level of selectivity.
28 //
29 // The file name is passed back to DDLParser via SetDDLFileName in order to
30 // process this list of files later.
31 // ---------------------------------------------------------------------------
32 void DDLSAX2ConfigHandler::startElement(const XMLCh* const uri,
33  const XMLCh* const localname,
34  const XMLCh* const qname,
35  const Attributes& attrs) {
36  if (XMLString::equals(qname, uStr("File").ptr())) {
37  std::string name = toString(attrs.getValue(uStr("name").ptr()));
38  std::string url = toString(attrs.getValue(uStr("url").ptr()));
39 
40  files_.emplace_back(name);
41  urls_.emplace_back(url);
42  } else if (XMLString::equals(qname, uStr("Root").ptr())) {
43  std::string fileName = toString(attrs.getValue(uStr("fileName").ptr()));
44  std::string logicalPartName = toString(attrs.getValue(uStr("logicalPartName").ptr()));
45 
46  fileName = fileName.substr(0, fileName.find('.'));
47  DDLogicalPart root(DDName(logicalPartName, fileName));
49  cpv_.setRoot(root);
50  } else if (XMLString::equals(qname, uStr("Schema").ptr())) {
51  schemaLocation_ = toString(attrs.getValue(uStr("schemaLocation").ptr()));
52  doValidation_ = XMLString::equals(attrs.getValue(uStr("validation").ptr()), uStr("true").ptr());
53  }
54 }
55 
56 const std::vector<std::string>& DDLSAX2ConfigHandler::getFileNames(void) const { return files_; }
57 
58 const std::vector<std::string>& DDLSAX2ConfigHandler::getURLs(void) const { return urls_; }
59 
61 
62 const bool DDLSAX2ConfigHandler::doValidation(void) const { return doValidation_; }
XercesStrUtils.h
relmon_authenticated_wget.url
url
Definition: relmon_authenticated_wget.py:22
DDLSAX2ConfigHandler::startElement
void startElement(const XMLCh *uri, const XMLCh *localname, const XMLCh *qname, const Attributes &attrs) override
Definition: DDLSAX2ConfigHandler.cc:32
DDLSAX2ConfigHandler::getSchemaLocation
const std::string getSchemaLocation() const
Definition: DDLSAX2ConfigHandler.cc:60
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
DDName
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
DDLSAX2ConfigHandler::urls_
std::vector< std::string > urls_
Definition: DDLSAX2ConfigHandler.h:41
cms::xerces
Definition: XercesStrUtils.h:10
DDLSAX2Handler.h
DDCompactView::setRoot
void setRoot(const DDLogicalPart &root)
Definition: DDCompactView.cc:96
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
DDCompactView.h
DDLSAX2ConfigHandler::cpv_
DDCompactView & cpv_
Definition: DDLSAX2ConfigHandler.h:43
DDLSAX2ConfigHandler::schemaLocation_
std::string schemaLocation_
Definition: DDLSAX2ConfigHandler.h:42
toolbox::toString
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
DDLSAX2ConfigHandler.h
equals
bool equals(const edm::RefToBase< Jet > &j1, const edm::RefToBase< Jet > &j2)
Definition: DeepCMVATagInfoProducer.cc:56
DDLSAX2ConfigHandler::doValidation
const bool doValidation() const
Definition: DDLSAX2ConfigHandler.cc:62
DDI::Singleton::instance
static value_type & instance()
DDLogicalPart
A DDLogicalPart aggregates information concerning material, solid and sensitveness ....
Definition: DDLogicalPart.h:93
root
Definition: RooFitFunction.h:10
DDLSAX2ConfigHandler::~DDLSAX2ConfigHandler
~DDLSAX2ConfigHandler() override
Definition: DDLSAX2ConfigHandler.cc:18
cms::xerces::uStr
ZStr< XMLCh > uStr(char const *str)
Definition: XercesStrUtils.h:31
DDLSAX2ConfigHandler::getFileNames
const std::vector< std::string > & getFileNames() const
Definition: DDLSAX2ConfigHandler.cc:56
DDLogicalPart.h
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDLSAX2ConfigHandler::doValidation_
bool doValidation_
Definition: DDLSAX2ConfigHandler.h:39
DDLSAX2Handler::Attributes
XERCES_CPP_NAMESPACE::Attributes Attributes
Definition: DDLSAX2Handler.h:29
DDRoot.h
DDName.h
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
DDLSAX2ConfigHandler::getURLs
const std::vector< std::string > & getURLs() const
Definition: DDLSAX2ConfigHandler.cc:58
DDLSAX2ConfigHandler::DDLSAX2ConfigHandler
DDLSAX2ConfigHandler(DDCompactView &cpv)
Definition: DDLSAX2ConfigHandler.cc:15
DDLSAX2ConfigHandler::files_
std::vector< std::string > files_
Definition: DDLSAX2ConfigHandler.h:40