add a load() overload to specify name pool size

This commit is contained in:
Guenter Obiltschnig 2016-10-07 10:59:24 +02:00
parent a53464e784
commit bae5b38df0
2 changed files with 14 additions and 2 deletions

View File

@ -134,6 +134,12 @@ public:
/// Loads the XML document containing the configuration data
/// from the given InputSource.
void load(Poco::XML::InputSource* pInputSource, unsigned long namePoolSize);
/// Loads the XML document containing the configuration data
/// from the given InputSource. Uses the give namePoolSize (which
/// should be a suitable prime like 251, 509, 1021, 4093) for the
/// internal DOM Document's name pool.
void load(std::istream& istr);
/// Loads the XML document containing the configuration data
/// from the given stream.

View File

@ -123,11 +123,11 @@ XMLConfiguration::~XMLConfiguration()
}
void XMLConfiguration::load(Poco::XML::InputSource* pInputSource)
void XMLConfiguration::load(Poco::XML::InputSource* pInputSource, unsigned long namePoolSize)
{
poco_check_ptr (pInputSource);
Poco::XML::DOMParser parser;
Poco::XML::DOMParser parser(namePoolSize);
parser.setFeature(Poco::XML::XMLReader::FEATURE_NAMESPACES, false);
parser.setFeature(Poco::XML::DOMParser::FEATURE_FILTER_WHITESPACE, true);
Poco::XML::AutoPtr<Poco::XML::Document> pDoc = parser.parse(pInputSource);
@ -135,6 +135,12 @@ void XMLConfiguration::load(Poco::XML::InputSource* pInputSource)
}
void XMLConfiguration::load(Poco::XML::InputSource* pInputSource)
{
load(pInputSource, POCO_XML_NAMEPOOL_DEFAULT_SIZE);
}
void XMLConfiguration::load(std::istream& istr)
{
Poco::XML::InputSource src(istr);