X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Futil%2FParserPool.cpp;h=ca155cabfba2767054891827786207a7ce979729;hb=a05e99e26eb0b37f7892829dd773083f31bda816;hp=6a4700ded153e55e4d5aff591bbb48168133a93f;hpb=a93d0241cb0fcbbd03ec671ec92ace2cd1519af9;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/util/ParserPool.cpp b/xmltooling/util/ParserPool.cpp index 6a4700d..ca155ca 100644 --- a/xmltooling/util/ParserPool.cpp +++ b/xmltooling/util/ParserPool.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -236,6 +237,19 @@ bool ParserPool::loadSchema(const XMLCh* nsURI, const XMLCh* pathname) return true; } +bool ParserPool::loadCatalogs(const char* pathnames) +{ + string temp(pathnames); + boost::tokenizer< char_separator > catpaths(temp, char_separator(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(&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); @@ -325,6 +339,7 @@ DOMInputSource* ParserPool::resolveEntity( #endif if (!systemId) return nullptr; + xstring sysId(systemId); Category& log=Category::getInstance(XMLTOOLING_LOGCAT".ParserPool"); if (log.isDebugEnabled()) { @@ -334,14 +349,15 @@ DOMInputSource* ParserPool::resolveEntity( } // Find well-known schemas in the specified location. - map::const_iterator i = m_schemaLocMap.find(systemId); + map::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, boost::bind(&map::value_type::second, _1), systemId) + boost::bind(p_ends_with, boost::bind(&map::value_type::second, _1), boost::ref(sysId)) ); if (i != m_schemaLocMap.end()) return new Wrapper4InputSource(new LocalFileInputSource(baseURI, i->second.c_str()));