ParserPool::ParserPool(bool namespaceAware, bool schemaAware)
- : m_namespaceAware(namespaceAware), m_schemaAware(schemaAware), m_lock(Mutex::create()), m_security(new SecurityManager()) {}
+ : m_namespaceAware(namespaceAware), m_schemaAware(schemaAware), m_lock(Mutex::create()), m_security(new SecurityManager()) {
+
+ int expLimit = 0;
+ const char* env = getenv("XMLTOOLING_ENTITY_EXPANSION_LIMIT");
+ if (env) {
+ expLimit = atoi(env);
+ }
+ if (expLimit <= 0)
+ expLimit = XMLTOOLING_ENTITY_EXPANSION_LIMIT;
+ m_security->setEntityExpansionLimit(expLimit);
+}
ParserPool::~ParserPool()
{
string temp(pathnames);
vector<string> catpaths;
split(catpaths, temp, is_any_of(PATH_SEPARATOR_STR), algorithm::token_compress_on);
- for (vector<string>::iterator i = catpaths.begin(); i != catpaths.end(); ++i) {
- XMLToolingConfig::getConfig().getPathResolver()->resolve(*i, PathResolver::XMLTOOLING_XML_FILE);
- loadCatalog(i->c_str());
- }
+ static bool (ParserPool::* lc)(const char*) = &ParserPool::loadCatalog;
+ for_each(catpaths.begin(), catpaths.end(), boost::bind(lc, this, boost::bind(&string::c_str, _1)));
return !catpaths.empty();
}