m_parserPool=new ParserPool();
m_validatingPool=new ParserPool(true,true);
m_lock=xercesc::XMLPlatformUtils::makeMutex();
+
+ // Load catalogs from path.
+ if (!catalog_path.empty()) {
+ char* catpath=strdup(catalog_path.c_str());
+ char* sep=NULL;
+ char* start=catpath;
+ while (start && *start) {
+ sep=strchr(start,PATH_SEPARATOR_CHAR);
+ if (sep)
+ *sep=0;
+ auto_ptr_XMLCh temp(start);
+ m_validatingPool->loadCatalog(temp.get());
+ start = sep ? sep + 1 : NULL;
+ }
+ free(catpath);
+ }
// default registrations
XMLObjectBuilder::registerDefaultBuilder(new UnknownElementBuilder());
* @return reference to a validating parser pool.\r
*/\r
virtual ParserPool& getValidatingParser() const=0;\r
+ \r
+ /**\r
+ * Set to catalog files to load into validating parser pool at initialization time.\r
+ * Like other path settings, the separator depends on the platform\r
+ * (semicolon on Windows, colon otherwise). \r
+ */\r
+ std::string catalog_path;\r
\r
#ifndef XMLTOOLING_NO_XMLSEC\r
/**\r
#define XMLTOOLING_LOGCAT "XMLTooling"
+// Macros for path and directory separators.
+#if defined __CYGWIN32__ && !defined __CYGWIN__
+ /* For backwards compatibility with Cygwin b19 and
+ earlier, we define __CYGWIN__ here, so that
+ we can rely on checking just for that macro. */
+# define __CYGWIN__ __CYGWIN32__
+#endif
+
+#if defined _WIN32 && !defined __CYGWIN__
+ /* Use Windows separators on all _WIN32 defining
+ environments, except Cygwin. */
+# define DIR_SEPARATOR_CHAR '\\'
+# define DIR_SEPARATOR_STR "\\"
+# define PATH_SEPARATOR_CHAR ';'
+# define PATH_SEPARATOR_STR ";"
+#endif
+#ifndef DIR_SEPARATOR_CHAR
+ /* Assume that not having this is an indicator that all
+ are missing. */
+# define DIR_SEPARATOR_CHAR '/'
+# define DIR_SEPARATOR_STR "/"
+# define PATH_SEPARATOR_CHAR ':'
+# define PATH_SEPARATOR_STR ":"
+#endif /* !DIR_SEPARATOR_CHAR */
+
namespace xmltooling {
/// @cond OFF
public:\r
bool setUpWorld() {\r
XMLToolingConfig::getConfig().log_config();\r
- if (!XMLToolingConfig::getConfig().init())\r
- return false;\r
+\r
if (getenv("XMLTOOLINGTEST_DATA"))\r
data_path=std::string(getenv("XMLTOOLINGTEST_DATA")) + "/";\r
- std::string catpath=data_path + "catalog.xml";\r
- auto_ptr_XMLCh temp(catpath.c_str());\r
- return XMLToolingConfig::getConfig().getValidatingParser().loadCatalog(temp.get());\r
+ XMLToolingConfig::getConfig().catalog_path = data_path + "catalog.xml";\r
+\r
+ if (!XMLToolingConfig::getConfig().init())\r
+ return false;\r
+ \r
+ return true;\r
}\r
bool tearDownWorld() {\r
XMLToolingConfig::getConfig().term();\r