[cpp-xmltooling COMMIT] in /branches/REL_1/xmltooling: XMLToolingConfig.cpp XMLToolingConfig.h util/ParserPool.cpp ut...

noreply at shibboleth.net noreply at shibboleth.net
Wed Dec 21 19:33:37 GMT 2011


Author: scantor
Date: Wed Dec 21 19:33:37 2011
New Revision: 942

URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=942&view=rev
Log:
Move catalog handling to parser API from config API.

Modified:
    branches/REL_1/xmltooling/XMLToolingConfig.cpp
    branches/REL_1/xmltooling/XMLToolingConfig.h
    branches/REL_1/xmltooling/util/ParserPool.cpp
    branches/REL_1/xmltooling/util/ParserPool.h

Modified: branches/REL_1/xmltooling/XMLToolingConfig.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/XMLToolingConfig.cpp?rev=942&r1=941&r2=942&view=diff
==============================================================================
--- branches/REL_1/xmltooling/XMLToolingConfig.cpp (original)
+++ branches/REL_1/xmltooling/XMLToolingConfig.cpp Wed Dec 21 19:33:37 2011
@@ -55,9 +55,7 @@
 #endif
 
 #include <stdexcept>
-#include <boost/bind.hpp>
 #include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/tokenizer.hpp>
 
 #if defined(XMLTOOLING_LOG4SHIB)
 # include <log4shib/PropertyConfigurator.hh>
@@ -423,16 +421,9 @@
         m_parserPool=new ParserPool();
         m_validatingPool=new ParserPool(true,true);
 
-        // Load catalogs from path.
-        if (!catalog_path.empty()) {
-            boost::tokenizer< char_separator<char> > catpaths(catalog_path, 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),
-                    m_validatingPool, boost::bind(&string::c_str,_1))
-                );
-        }
+        // Load catalogs from deprecated path setting.
+        if (!catalog_path.empty())
+            m_validatingPool->loadCatalogs(catalog_path.c_str());
 
         // default registrations
         XMLObjectBuilder::registerDefaultBuilder(new UnknownElementBuilder());

Modified: branches/REL_1/xmltooling/XMLToolingConfig.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/XMLToolingConfig.h?rev=942&r1=941&r2=942&view=diff
==============================================================================
--- branches/REL_1/xmltooling/XMLToolingConfig.h (original)
+++ branches/REL_1/xmltooling/XMLToolingConfig.h Wed Dec 21 19:33:37 2011
@@ -250,6 +250,7 @@
         void setURLEncoder(URLEncoder* urlEncoder);
         
         /**
+         * @deprecated
          * List of catalog files to load into validating parser pool at initialization time.
          * <p>Like other path settings, the separator depends on the platform
          * (semicolon on Windows, colon otherwise). 

Modified: branches/REL_1/xmltooling/util/ParserPool.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/util/ParserPool.cpp?rev=942&r1=941&r2=942&view=diff
==============================================================================
--- branches/REL_1/xmltooling/util/ParserPool.cpp (original)
+++ branches/REL_1/xmltooling/util/ParserPool.cpp Wed Dec 21 19:33:37 2011
@@ -39,6 +39,7 @@
 #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>
@@ -234,6 +235,18 @@
     for_each(m_schemaLocMap.begin(), m_schemaLocMap.end(), doubleit<xstring>(m_schemaLocations,chSpace));
 
     return true;
+}
+
+bool ParserPool::loadCatalogs(const char* pathnames)
+{
+    boost::tokenizer< char_separator<char> > catpaths(string(pathnames), 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)

Modified: branches/REL_1/xmltooling/util/ParserPool.h
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/util/ParserPool.h?rev=942&r1=941&r2=942&view=diff
==============================================================================
--- branches/REL_1/xmltooling/util/ParserPool.h (original)
+++ branches/REL_1/xmltooling/util/ParserPool.h Wed Dec 21 19:33:37 2011
@@ -107,15 +107,28 @@
         xercesc::DOMDocument* parse(std::istream& is);
 
         /**
+         * Load OASIS catalog files to map schema namespace URIs to filenames.
+         *
+         * <p>This does not provide real catalog support; only the &lt;uri&gt; element
+         * is supported to map from a namespace URI to a relative path or file:// URI.
+         *
+         * <p>Multiple files can be specified using a platform-specific path delimiter.
+         *
+         * @param pathname  path to one or more catalog files

[... 20 lines stripped ...]


More information about the commits mailing list