2 * @file XML_Schema_Resolver.h
3 * @author Will Otte <wotte@dre.vanderbilt.edu>
5 * Resolves schema locations.
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)
14 #endif /* ACE_LACKS_PRAGMA_ONCE */
16 #include "XML_Utils_Export.h"
17 #include "XercesString.h"
19 #include <xercesc/sax/EntityResolver.hpp>
23 using namespace xercesc
;
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
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);
54 XML_Schema_Resolver (XML_Schema_Resolver
<Resolver
> &);
60 * @class NoOp_Resolver
61 * @brief Resolver that does nothing.
65 const XMLCh
* operator() (const XMLCh
*const,
66 const XMLCh
*const systemId
) const
71 * @class Basic_Resolver
72 * @brief Resolves a schema location from a fixed path.
76 Basic_Resolver (const ACE_TCHAR
*path
);
78 XMLCh
* operator() (const XMLCh
*const publicId
,
79 const XMLCh
*const systemId
) const;
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 */