27 #include "../common/Translator.h" 
   33 #include <xercesc/parsers/XercesDOMParser.hpp> 
   34 #include <xercesc/sax/SAXException.hpp> 
   35 #include <xercesc/sax2/XMLReaderFactory.hpp> 
   36 #include <xercesc/util/XMLException.hpp> 
   43                                        const bool doNamespace,
 
   47   assert(xmlFile.empty() == 
false);
 
   49   std::auto_ptr<xercesc::XercesDOMParser> parser(
new xercesc::XercesDOMParser());
 
   50   std::auto_ptr<ErrorHandler> errHandler(
new ErrorHandler);
 
   51   parser->setErrorHandler(errHandler.get());
 
   53   xercesc::XercesDOMParser::ValSchemes valScheme = valid ? xercesc::XercesDOMParser::Val_Always : xercesc::XercesDOMParser::Val_Never;
 
   57   parser->setDoNamespaces(doNamespace);
 
   58   parser->setDoSchema(doSchema);
 
   59   parser->setValidationScheme(valScheme);
 
   60   parser->cacheGrammarFromParse(
true);
 
   65     parser->parse(xmlFile.c_str());
 
   67   catch(
const xercesc::SAXException& e)
 
   69     std::string m =  
TR_XERCES(
"Could not read the XML file: ");
 
   71                 m += 
TR_XERCES(
", due to the following error: ");
 
   76   catch(
const xercesc::DOMException& e)
 
   78     std::string m =  
TR_XERCES(
"Could not read the XML file: ");
 
   80                 m += 
TR_XERCES(
", due to the following error: ");
 
   85   catch(
const xercesc::XMLException& e)
 
   87     std::string m =  
TR_XERCES(
"Could not read the XML file: ");
 
   89                 m += 
TR_XERCES(
", due to the following error: ");
 
   95   if(parser->getErrorCount() > 0)
 
   97     std::string m =  
TR_XERCES(
"Could not read the XML file: ");
 
   99                 m += 
", due to the following problem: ";
 
  100                 m += errHandler->getErrors();
 
  106   xercesc::DOMDocument* doc = parser->adoptDocument();
 
  109     throw Exception(
TR_XERCES(
"Unable to read the XML document!"));
 
This class implements Xerces interface for error handlers. 
 
An exception class for the xerces module. 
 
std::string ToString(const XMLCh *const value)
It converts the XML string to a standard C++ string. 
 
TEXERCESEXPORT xercesc::DOMDocument * readXML(const std::string &xmlFile, const bool doNamespace=false, const bool doSchema=false, const bool valid=false)
It reads the XML file using the DOM API. 
 
This class implements Xerces interface for error handlers. 
 
#define TR_XERCES(message)
It marks a string in order to get translated. This is a special mark used in the Xerces module of Ter...