27 #include <xercesc/util/PlatformUtils.hpp> 50 XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
52 }
catch (
const XERCES_CPP_NAMESPACE::XMLException& e) {
60 if (validationScheme ==
"never") {
62 }
else if (validationScheme ==
"auto") {
64 }
else if (validationScheme ==
"always") {
67 throw ProcessError(
"Unknown xml validation scheme + '" + validationScheme +
"'.");
69 if (netValidationScheme ==
"never") {
71 }
else if (netValidationScheme ==
"auto") {
73 }
else if (netValidationScheme ==
"always") {
76 throw ProcessError(
"Unknown network validation scheme + '" + netValidationScheme +
"'.");
92 for (std::vector<SUMOSAXReader*>::iterator i =
myReaders.begin(); i !=
myReaders.end(); ++i) {
96 XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
114 const std::string& file,
const bool isNet) {
130 WRITE_ERROR(std::string(e.what()) != std::string(
"") ? std::string(e.what()) : std::string(
"Process Error"));
132 }
catch (
const std::runtime_error& re) {
133 WRITE_ERROR(
"Runtime error: " + std::string(re.what()) +
" while parsing '" + file +
"'");
135 }
catch (
const std::exception& ex) {
136 WRITE_ERROR(
"Error occurred: " + std::string(ex.what()) +
" while parsing '" + file +
"'");
139 WRITE_ERROR(
"Unspecified error occurred 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.
static std::string transcode(const XMLCh *const data)
converts a 0-terminated XMLCh* array (usually UTF-16, stemming from Xerces) into std::string in UTF-8...
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 bool isValidating(const bool net=false)
Returns whether validation is enabled.
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.