Rework support for libcurl-based input to parser.
[shibboleth/cpp-xmltooling.git] / xmltooling / util / ReloadableXMLFile.cpp
index ad43f6f..0aad73b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
- *  Copyright 2001-2007 Internet2\r
+ *  Copyright 2001-2009 Internet2\r
  * \r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -33,7 +33,6 @@
 \r
 #include <xercesc/framework/LocalFileInputSource.hpp>\r
 #include <xercesc/framework/Wrapper4InputSource.hpp>\r
-#include <xercesc/framework/URLInputSource.hpp>\r
 #include <xercesc/util/XMLUniDefs.hpp>\r
 \r
 using namespace xmltooling::logging;\r
@@ -157,8 +156,8 @@ pair<bool,DOMElement*> ReloadableXMLFile::load(bool backup)
                 m_log.debug("loading configuration from external resource...");\r
 \r
             DOMDocument* doc=NULL;\r
-            auto_ptr_XMLCh widenit(backup ? m_backing.c_str() : m_source.c_str());\r
             if (m_local || backup) {\r
+                auto_ptr_XMLCh widenit(backup ? m_backing.c_str() : m_source.c_str());\r
                 LocalFileInputSource src(widenit.get());\r
                 Wrapper4InputSource dsrc(&src,false);\r
                 if (m_validate)\r
@@ -167,7 +166,7 @@ pair<bool,DOMElement*> ReloadableXMLFile::load(bool backup)
                     doc=XMLToolingConfig::getConfig().getParser().parse(dsrc);\r
             }\r
             else {\r
-                URLInputSource src(widenit.get());\r
+                URLInputSource src(m_root);\r
                 Wrapper4InputSource dsrc(&src,false);\r
                 if (m_validate)\r
                     doc=XMLToolingConfig::getConfig().getValidatingParser().parse(dsrc);\r