#include <functional>
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
+#include <boost/tokenizer.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
#include <xercesc/sax/SAXException.hpp>
return true;
}
+bool ParserPool::loadCatalogs(const char* pathnames)
+{
+ string temp(pathnames);
+ boost::tokenizer< char_separator<char> > catpaths(temp, char_separator<char>(PATH_SEPARATOR_STR));
+ for_each(
+ catpaths.begin(), catpaths.end(),
+ // Call loadCatalog with an inner call to s->c_str() on each entry.
+ boost::bind(static_cast<bool (ParserPool::*)(const char*)>(&ParserPool::loadCatalog),
+ boost::ref(this), boost::bind(&string::c_str, _1))
+ );
+ return catpaths.begin() != catpaths.end();
+}
+
bool ParserPool::loadCatalog(const char* pathname)
{
auto_ptr_XMLCh temp(pathname);
#endif
if (!systemId)
return nullptr;
+ xstring sysId(systemId);
Category& log=Category::getInstance(XMLTOOLING_LOGCAT".ParserPool");
if (log.isDebugEnabled()) {
}
// Find well-known schemas in the specified location.
- map<xstring,xstring>::const_iterator i = m_schemaLocMap.find(systemId);
+ map<xstring,xstring>::const_iterator i = m_schemaLocMap.find(sysId);
if (i != m_schemaLocMap.end())
return new Wrapper4InputSource(new LocalFileInputSource(baseURI, i->second.c_str()));
// Check for entity as a suffix of a value in the map.
+ bool (*p_ends_with)(const xstring&, const xstring&) = ends_with;
i = find_if(
m_schemaLocMap.begin(), m_schemaLocMap.end(),
- boost::bind(ends_with<const xstring&,const xstring&>, boost::bind(&map<xstring,xstring>::value_type::second, _1), systemId)
+ boost::bind(p_ends_with, boost::bind(&map<xstring,xstring>::value_type::second, _1), boost::ref(sysId))
);
if (i != m_schemaLocMap.end())
return new Wrapper4InputSource(new LocalFileInputSource(baseURI, i->second.c_str()));