Don't bother setting an SSL version, we're not trusting it anyway.
[shibboleth/cpp-xmltooling.git] / xmltooling / util / ParserPool.h
index f4f9a8f..3dcdde6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright 2001-2006 Internet2
+ *  Copyright 2001-2007 Internet2
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 /**
- * @file ParserPool.h
+ * @file xmltooling/util/ParserPool.h
  * 
- * XML parsing
+ * A thread-safe pool of DOMBuilders that share characteristics.
  */
 
-#if !defined(__xmltooling_pool_h__)
+#ifndef __xmltooling_pool_h__
 #define __xmltooling_pool_h__
 
 #include <xmltooling/unicode.h>
@@ -32,8 +32,7 @@
 #include <xercesc/dom/DOM.hpp>
 #include <xercesc/sax/InputSource.hpp>
 #include <xercesc/util/BinInputStream.hpp>
-
-using namespace xercesc;
+#include <xercesc/util/SecurityManager.hpp>
 
 #if defined (_MSC_VER)
     #pragma warning( push )
@@ -43,9 +42,9 @@ using namespace xercesc;
 namespace xmltooling {
 
     /**
-     * A thread-safe pool of DOMBuilders that share characteristics
+     * A thread-safe pool of DOMBuilders that share characteristics.
      */
-    class XMLTOOL_API ParserPool : public DOMEntityResolver, DOMErrorHandler
+    class XMLTOOL_API ParserPool : public xercesc::DOMEntityResolver, xercesc::DOMErrorHandler
     {
         MAKE_NONCOPYABLE(ParserPool);
     public:
@@ -64,7 +63,7 @@ namespace xmltooling {
          * @return new XML document
          * 
          */
-        DOMDocument* newDocument();
+        xercesc::DOMDocument* newDocument();
 
         /**
          * Parses a document using a pooled parser with the proper settings
@@ -73,7 +72,7 @@ namespace xmltooling {
          * @return The DOM document resulting from the parse
          * @throws XMLParserException thrown if there was a problem reading, parsing, or validating the XML
          */
-        DOMDocument* parse(DOMInputSource& domsrc);
+        xercesc::DOMDocument* parse(xercesc::DOMInputSource& domsrc);
 
         /**
          * Parses a document using a pooled parser with the proper settings
@@ -82,7 +81,7 @@ namespace xmltooling {
          * @return The DOM document resulting from the parse
          * @throws XMLParserException thrown if there was a problem reading, parsing, or validating the XML
          */
-        DOMDocument* parse(std::istream& is);
+        xercesc::DOMDocument* parse(std::istream& is);
 
         /**
          * Load an OASIS catalog file to map schema namespace URIs to filenames.
@@ -110,17 +109,17 @@ namespace xmltooling {
         /**
          * Supplies all external entities (primarily schemas) to the parser
          */
-        DOMInputSource* resolveEntity(const XMLCh* const publicId, const XMLCh* const systemId, const XMLCh* const baseURI);
+        xercesc::DOMInputSource* resolveEntity(const XMLCh* const publicId, const XMLCh* const systemId, const XMLCh* const baseURI);
 
         /**
          * Handles parsing errors
          */
-        bool handleError(const DOMError& e);
+        bool handleError(const xercesc::DOMError& e);
 
     private:
-        DOMBuilder* createBuilder();
-        DOMBuilder* checkoutBuilder();
-        void checkinBuilder(DOMBuilder* builder);
+        xercesc::DOMBuilder* createBuilder();
+        xercesc::DOMBuilder* checkoutBuilder();
+        void checkinBuilder(xercesc::DOMBuilder* builder);
 
 #ifdef HAVE_GOOD_STL
         xstring m_schemaLocations;
@@ -130,14 +129,15 @@ namespace xmltooling {
         std::map<std::string,std::string> m_schemaLocMap;
 #endif
         bool m_namespaceAware,m_schemaAware;
-        std::stack<DOMBuilder*> m_pool;
+        std::stack<xercesc::DOMBuilder*> m_pool;
         Mutex* m_lock;
+        xercesc::SecurityManager* m_security;
     };
 
     /**
      * A parser source that wraps a C++ input stream
      */
-    class XMLTOOL_API StreamInputSource : public InputSource
+    class XMLTOOL_API StreamInputSource : public xercesc::InputSource
     {
     MAKE_NONCOPYABLE(StreamInputSource);
     public:
@@ -147,15 +147,15 @@ namespace xmltooling {
          * @param is        reference to an input stream
          * @param systemId  optional system identifier to attach to the stream
          */
-        StreamInputSource(std::istream& is, const char* systemId=NULL) : InputSource(systemId), m_is(is) {}
+        StreamInputSource(std::istream& is, const char* systemId=NULL) : xercesc::InputSource(systemId), m_is(is) {}
         /// @cond off
-        virtual BinInputStream* makeStream() const { return new StreamBinInputStream(m_is); }
+        virtual xercesc::BinInputStream* makeStream() const { return new StreamBinInputStream(m_is); }
         /// @endcond
 
         /**
          * A Xerces input stream that wraps a C++ input stream
          */
-        class XMLTOOL_API StreamBinInputStream : public BinInputStream
+        class XMLTOOL_API StreamBinInputStream : public xercesc::BinInputStream
         {
         public:
             /**