blob: afa2ef14dc7a7ce45629977b616cdc7efc3f8593 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
// $Id$
#include "XML/XML_Schema_Resolver.h"
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/XercesDefs.hpp>
#include "XML/XercesString.h"
#include "ace/Env_Value_T.h"
#include <iostream>
namespace CIAO
{
namespace XML
{
Basic_Resolver::Basic_Resolver (const ACE_TCHAR *path)
: path_ (path)
{
}
XMLCh *
Basic_Resolver::operator() (const XMLCh *const,
const XMLCh *const systemId) const
{
XStr path (path_);
path.append (systemId);
return path.release ();
}
Environment_Resolver::Environment_Resolver (const ACE_TCHAR *variable,
const ACE_TCHAR *relpath)
{
xercesc::XMLPlatformUtils::Initialize();
this->add_path (variable, relpath);
}
using xercesc::XMLPlatformUtils;
void
Environment_Resolver::add_path (const ACE_TCHAR *variable,
const ACE_TCHAR *relpath)
{
ACE_Env_Value <const ACE_TCHAR *> path_env (variable,
ACE_TEXT(""));
XStr xpath (path_env);
XStr xrelpath (relpath);
xpath.append (xrelpath);
paths_.push_back (xpath);
}
XMLCh *
Environment_Resolver::operator() (const XMLCh *const,
const XMLCh *const systemId) const
{
for (std::vector<XStr>::const_iterator i = this->paths_.begin ();
i != this->paths_.end ();
++i)
{
XStr path (*i);
path.append(systemId);
FileHandle file (XMLPlatformUtils::openFile (path));
if (file != 0)
{
XMLPlatformUtils::closeFile (file);
return path.release ();
}
}
return 0;
}
}
}
|