Fixed typos
[ACE_TAO.git] / ACE / ace / XML_Utils / XML_Schema_Resolver.h
blob9ad59f422a3fb94443b63851591264e943f942ed
1 /**
2 * @file XML_Schema_Resolver.h
3 * @author Will Otte <wotte@dre.vanderbilt.edu>
5 * Resolves schema locations.
6 */
8 #ifndef ACE_XML_SCHEMA_RESOLVER_H
9 #define ACE_XML_SCHEMA_RESOLVER_H
10 #include /**/ "ace/pre.h"
12 #if !defined (ACE_LACKS_PRAGMA_ONCE)
13 #pragma once
14 #endif /* ACE_LACKS_PRAGMA_ONCE */
16 #include "XML_Utils_Export.h"
17 #include "XercesString.h"
19 #include <xercesc/sax/EntityResolver.hpp>
20 #include <vector>
21 #include <string>
23 using namespace xercesc;
25 namespace XML
27 // forward decl.
28 struct NoOp_Resolver;
30 /**
31 * @class XML_Schema_Resolver
32 * @brief Resolves schema locations
34 * Template argument Resolver should be a functor with an operation
35 * const ACE_TCHAR * operator () (...arguments from resolveEntity...)
37 template <typename Resolver = NoOp_Resolver>
38 class XML_Schema_Resolver
39 : public virtual EntityResolver
41 public:
42 XML_Schema_Resolver (void);
44 XML_Schema_Resolver (Resolver &resolver);
46 /// This function is called by the Xerces infrastructure to
47 /// actually resolve the location of a schema.
48 virtual InputSource * resolveEntity (const XMLCh *const publicId,
49 const XMLCh *const systemId);
51 Resolver &get_resolver (void);
53 private:
54 XML_Schema_Resolver (XML_Schema_Resolver<Resolver> &);
56 Resolver resolver_;
59 /**
60 * @class NoOp_Resolver
61 * @brief Resolver that does nothing.
63 struct NoOp_Resolver
65 const XMLCh* operator() (const XMLCh *const,
66 const XMLCh *const systemId) const
67 { return systemId; };
70 /**
71 * @class Basic_Resolver
72 * @brief Resolves a schema location from a fixed path.
74 struct Basic_Resolver
76 Basic_Resolver (const ACE_TCHAR *path);
78 XMLCh* operator() (const XMLCh *const publicId,
79 const XMLCh *const systemId) const;
80 XStr path_;
83 /**
84 * @class Environment_Resolver
85 * @brief Resolves a schema location from a path from an environment variable.
87 struct XML_Utils_Export Environment_Resolver
89 Environment_Resolver (void);
91 Environment_Resolver (const ACE_TCHAR *variable,
92 const ACE_TCHAR *path);
94 void add_path (const ACE_TCHAR *variable,
95 const ACE_TCHAR *path);
97 XMLCh* operator() (const XMLCh *const publicId,
98 const XMLCh *const systemId) const;
100 std::vector<XStr> paths_;
104 #include "XML_Schema_Resolver.tpp"
106 #include /**/ "ace/post.h"
108 #endif /* ACE_XML_SCHEMA_RESOLVER_H */