9 #include <xercesc/framework/MemBufInputSource.hpp> 10 #include <xercesc/sax2/XMLReaderFactory.hpp> 11 #include <xercesc/util/XMLUni.hpp> 28 SAX2Parser_->setFeature(XMLUni::fgSAX2CoreValidation,
false);
29 SAX2Parser_->setFeature(XMLUni::fgSAX2CoreNameSpaces,
false);
67 FileNameHolder::const_iterator it =
fileNames_.begin();
69 bool foundFile =
false;
72 if( it->second.first == filename )
101 size_t foundFile =
isFound( filename );
104 pair< std::string, std::string >
pss;
106 pss.second = absoluteFileName;
117 LogDebug (
"DDLParser") <<
"ParseOneFile() Parsing: " <<
fileNames_[fIndex].second << std::endl;
139 MemBufInputSource mbis( &*ablob.begin(), bsize, dummy );
146 edm::LogInfo (
"DDLParser") <<
"Start Parsing. Validation is set off for the time being." << std::endl;
148 SAX2Parser_->setFeature( XMLUni::fgSAX2CoreValidation,
false );
149 SAX2Parser_->setFeature( XMLUni::fgSAX2CoreNameSpaces,
false );
152 size_t fileIndex = 0;
153 std::vector<std::string> fullFileName;
154 const std::vector < std::string >& fileList = dp.
getFileList();
155 const std::vector < std::string >& urlList = dp.
getURLList();
157 for(; fileIndex < fileList.size(); ++fileIndex )
161 if ( ts.size() > 0 ) {
162 if ( ts[ts.size() - 1] ==
'/') {
163 fullFileName.push_back( ts + tf );
165 fullFileName.push_back( ts +
"/" + tf );
168 fullFileName.push_back( tf );
172 for(
const auto& fnit : fullFileName )
178 pair <std::string, std::string>
pss;
219 pair<std::string, std::string> namePair =
fileNames_[
i];
220 LogDebug (
"DDLParser") <<
"Completed parsing file " << namePair.second << std::endl;
248 return( fullname.substr( fullname.rfind(
'/' ) + 1 ));
256 while (j < fname.size() && fname[j] !=
'.')
258 if (j < fname.size() && fname[j] ==
'.')
259 ret = fname.substr(0, j);
int parse(const DDLDocumentProvider &dp)
Parse all files. Return is meaningless.
std::map< int, bool > parsed_
Parse status of a given file.
std::pair< ALIstring, ALIstring > pss
XERCES_CPP_NAMESPACE::SAX2XMLReader SAX2XMLReader
DDLSAX2FileHandler * fileHandler_
SAX2XMLReader * SAX2Parser_
SAX2XMLReader is one way of parsing.
std::string currFileName_
Which file is currently being processed.
FileNameHolder fileNames_
List of files to be processed, obtained from the DDLDocumentProvider.
type of data representation of DDCompactView
~DDLParser()
Destructor terminates the XMLPlatformUtils (as required by Xerces)
DDLSAX2FileHandler is the SAX2 Handler for XML files found in the configuration file.
std::string const extractFileName(const std::string &fullname)
size_t isFound(const std::string &filename)
Is the file already known by the DDLParser? Returns 0 if not found, and index if found.
virtual const std::vector< std::string > & getURLList(void) const =0
Return a list of urls as a vector of strings.
DDLSAX2ExpressionHandler is the first pass SAX2 Handler for XML files found in the configuration file...
DDLSAX2ExpressionHandler * expHandler_
bool parseOneFile(const std::string &filename)
Process a single files.
DDLSAX2Handler * errHandler_
void clearFiles()
Clear the file list - see Warning!
DDLSAX2FileHandler * getDDLSAX2FileHandler()
To get the parent this class allows access to the handler.
void parseFile(const int &numtoproc)
Parse File. Just to hold some common looking code.
virtual const std::vector< std::string > & getFileList(void) const =0
Return a list of files as a vector of strings.
size_t nFiles_
Number of files + 1.
SAX2XMLReader * getXMLParser()
Get the SAX2Parser from the DDLParser. USE WITH CAUTION. Set your own handler, etc.
virtual void setNameSpace(const std::string &nms)
DDLDocumentProvider provides a set of URLs and filenames.
std::string const getNameSpace(const std::string &fname)
DDLSAX2Handler inherits from Xerces C++ DefaultHandler.
std::string fullPath() const
bool isParsed(const std::string &filename)
Is the file already parsed?