33 #include <xercesc/util/PlatformUtils.hpp>
40 #ifdef CHECK_MEMORY_LEAKS
42 #endif // CHECK_MEMORY_LEAKS
60 XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
62 }
catch (
const XERCES_CPP_NAMESPACE::XMLException& e) {
70 if (validationScheme ==
"never") {
72 }
else if (validationScheme ==
"auto") {
74 }
else if (validationScheme ==
"always") {
77 throw ProcessError(
"Unknown xml validation scheme + '" + validationScheme +
"'.");
79 if (netValidationScheme ==
"never") {
81 }
else if (netValidationScheme ==
"auto") {
83 }
else if (netValidationScheme ==
"always") {
86 throw ProcessError(
"Unknown network validation scheme + '" + netValidationScheme +
"'.");
93 for (std::vector<SUMOSAXReader*>::iterator i =
myReaders.begin(); i !=
myReaders.end(); ++i) {
97 XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
115 const std::string& file,
const bool isNet) {
131 WRITE_ERROR(std::string(e.what()) != std::string(
"") ? std::string(e.what()) : std::string(
"Process Error"));
133 }
catch (
const std::runtime_error& re) {
134 WRITE_ERROR(
"Runtime error: " + std::string(re.what()) +
" while parsing '" + file +
"'");
136 }
catch (
const std::exception& ex) {
137 WRITE_ERROR(
"Error occurred: " + std::string(ex.what()) +
" while parsing '" + file +
"'");
140 WRITE_ERROR(
"Unspecified error occured wile parsing '" + file +
"'");
static void init()
Initialises the xml-subsystem.
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
static void close()
Closes the xml-subsystem.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
SAX-reader encapsulation containing binary reader.
static int myNextFreeReader
Information whether the reader is parsing.
SAX-handler base for SUMO-files.
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything's ok.
A handler which converts occuring elements and attributes into enums.
const std::string & getFileName() const
returns the current file name
void setFileName(const std::string &name)
Sets the current file name.
static XERCES_CPP_NAMESPACE::SAX2XMLReader::ValSchemes myValidationScheme
Information whether built reader/parser shall validate XML-documents against schemata.
static SUMOSAXReader * getSAXReader(SUMOSAXHandler &handler)
Builds a reader and assigns the handler to it.
static void setHandler(GenericSAXHandler &handler)
Sets the given handler for the default reader.
bool wasInformed() const
Returns the information whether any messages were added.
static XERCES_CPP_NAMESPACE::SAX2XMLReader::ValSchemes myNetValidationScheme
Information whether built reader/parser shall validate SUMO networks against schemata.
static std::vector< SUMOSAXReader * > myReaders
The XML Readers used for repeated parsing.
static std::string _2str(const int var)
convert int to string