summaryrefslogtreecommitdiff
path: root/modules/CIAO/tools/Config_Handlers/Utils/XML_Schema_Resolver.cpp
diff options
context:
space:
mode:
authorjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-29 21:15:18 +0000
committerjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-29 21:15:18 +0000
commitb71531b42b3325fd6079a7039aae8641262c8adf (patch)
treea5b9aa16924c541fcb424ee9460b1ac7f5a89352 /modules/CIAO/tools/Config_Handlers/Utils/XML_Schema_Resolver.cpp
parenta0f67cc97c0050d907145e312135b60c0125e56e (diff)
downloadATCD-b71531b42b3325fd6079a7039aae8641262c8adf.tar.gz
branching/taggingDS-main
Diffstat (limited to 'modules/CIAO/tools/Config_Handlers/Utils/XML_Schema_Resolver.cpp')
-rw-r--r--modules/CIAO/tools/Config_Handlers/Utils/XML_Schema_Resolver.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/modules/CIAO/tools/Config_Handlers/Utils/XML_Schema_Resolver.cpp b/modules/CIAO/tools/Config_Handlers/Utils/XML_Schema_Resolver.cpp
new file mode 100644
index 00000000000..269e95ab425
--- /dev/null
+++ b/modules/CIAO/tools/Config_Handlers/Utils/XML_Schema_Resolver.cpp
@@ -0,0 +1,55 @@
+// $Id$
+#include "XML_Schema_Resolver.h"
+#include "XercesString.h"
+#include "ace/Env_Value_T.h"
+#include <xercesc/framework/LocalFileInputSource.hpp>
+#include <xercesc/framework/Wrapper4InputSource.hpp>
+
+using xercesc::Wrapper4InputSource;
+using xercesc::LocalFileInputSource;
+
+
+namespace CIAO
+{
+ namespace Config_Handlers
+ {
+ CIAO_Schema_Resolver::CIAO_Schema_Resolver (void)
+ {
+ this->base_path_ = this->resolve_from_environment ();
+ }
+
+ CIAO_Schema_Resolver::CIAO_Schema_Resolver (const char *path)
+ {
+ if (path == 0)
+ this->base_path_ = this->resolve_from_environment ();
+ else
+ this->base_path_ = path;
+ }
+
+ /// This function is called by the Xerces infrastructure to
+ /// actually resolve the location of a schema.
+ DOMInputSource *
+ CIAO_Schema_Resolver::resolveEntity (const XMLCh *const publicId,
+ const XMLCh *const systemId,
+ const XMLCh *const baseURI)
+ {
+ ACE_UNUSED_ARG (baseURI);
+ ACE_UNUSED_ARG (publicId);
+
+ XStr path (this->base_path_.c_str ());
+ path.append (systemId);
+
+ // Ownership of these objects is given to other people.
+ return new Wrapper4InputSource (new LocalFileInputSource (path));
+ }
+
+ std::string
+ CIAO_Schema_Resolver::resolve_from_environment (void)
+ {
+ ACE_Env_Value <const char *> path ("CIAO_ROOT", "");
+
+ std::string retval (path);
+ return retval += "/docs/schema/";
+ }
+ }
+}