33 #include <xercesc/util/PlatformUtils.hpp> 56 XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
58 }
catch (
const XERCES_CPP_NAMESPACE::XMLException& e) {
66 if (validationScheme ==
"never") {
68 }
else if (validationScheme ==
"auto") {
70 }
else if (validationScheme ==
"always") {
73 throw ProcessError(
"Unknown xml validation scheme + '" + validationScheme +
"'.");
75 if (netValidationScheme ==
"never") {
77 }
else if (netValidationScheme ==
"auto") {
79 }
else if (netValidationScheme ==
"always") {
82 throw ProcessError(
"Unknown network validation scheme + '" + netValidationScheme +
"'.");
89 for (std::vector<SUMOSAXReader*>::iterator i =
myReaders.begin(); i !=
myReaders.end(); ++i) {
93 XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
111 const std::string& file,
const bool isNet) {
127 WRITE_ERROR(std::string(e.what()) != std::string(
"") ? std::string(e.what()) : std::string(
"Process Error"));
129 }
catch (
const std::runtime_error& re) {
130 WRITE_ERROR(
"Runtime error: " + std::string(re.what()) +
" while parsing '" + file +
"'");
132 }
catch (
const std::exception& ex) {
133 WRITE_ERROR(
"Error occurred: " + std::string(ex.what()) +
" while parsing '" + file +
"'");
136 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.
const std::string & getFileName() const
returns the current file name
SAX-reader encapsulation containing binary reader.
static int myNextFreeReader
Information whether the reader is parsing.
SAX-handler base for SUMO-files.
bool wasInformed() const
Returns the information whether any messages were added.
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.
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.
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