I am having a problem with Xerces 2.8. I have the following code:
void ConfigReader::readConfig()
{
ConfigErrorHandler err;
try
{
xercesc::XercesDOMParser parser;
parser.setValidationScheme(xercesc::XercesDOMParser::Val_Auto);
parser.setErrorHandler(&err);
parser.parse(configpath.c_str());
doc = parser.getDocument();
if (doc)
{
xercesc::DOMElement *root = doc->getDocumentElement();
}
}
catch (const xercesc::XMLException& e)
{
StringHelper error(e.getMessage());
throw ConfigException(std::string("Configuration error: ")
+ std::string(error.toString()));
}
}
The file it is reading looks like this:
<rahub>
<general/>
</rahub>
When I call DOMDocument::getDocumentElement, it always returns null. There are
no calls to any of the error or warning methods in the error handler class and
there are no exceptions thrown. I actually just copied and pasted this code
from another application I wrote, which is working just fine.
Any ideas?