Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / ace / XML_Utils / XML_Schema_Resolver.cpp
blob28e916a047d11bf6f57cd73d32a920a076222d3d
1 #include "XML_Schema_Resolver.h"
3 #include <xercesc/util/PlatformUtils.hpp>
4 #include <xercesc/util/XercesDefs.hpp>
6 #include "XercesString.h"
8 #include "ace/Env_Value_T.h"
9 #include "ace/SString.h"
11 #include <iostream>
13 namespace XML
15 Basic_Resolver::Basic_Resolver (const ACE_TCHAR *path)
16 : path_ (path)
20 XMLCh *
21 Basic_Resolver::operator() (const XMLCh *const,
22 const XMLCh *const systemId) const
24 XStr path (path_);
25 path.append (systemId);
26 return path.release ();
29 Environment_Resolver::Environment_Resolver (const ACE_TCHAR *variable,
30 const ACE_TCHAR *relpath)
32 this->add_path (variable, relpath);
35 using xercesc::XMLPlatformUtils;
37 void
38 Environment_Resolver::add_path (const ACE_TCHAR *variable,
39 const ACE_TCHAR *relpath)
41 ACE_Env_Value <ACE_TString> path_env (variable,
42 ACE_TEXT(""));
44 XStr xpath (static_cast<ACE_TString>(path_env).c_str());
45 XStr xrelpath (relpath);
47 xpath.append (xrelpath);
49 paths_.push_back (xpath);
52 XMLCh *
53 Environment_Resolver::operator() (const XMLCh *const,
54 const XMLCh *const systemId) const
56 for (std::vector<XStr>::const_iterator i = this->paths_.begin ();
57 i != this->paths_.end ();
58 ++i)
60 XStr path (*i);
61 path.append(systemId);
63 FileHandle file (XMLPlatformUtils::openFile (path));
65 if (file != 0)
67 XMLPlatformUtils::closeFile (file);
68 return path.release ();
71 return 0;