 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
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) {
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 occurred wile parsing '" + file +
"'");
static std::vector< SUMOSAXReader * > myReaders
The XML Readers used for repeated parsing.
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.
SAX-handler base for SUMO-files.
bool wasInformed() const
Returns the information whether any messages were added.
static void close()
Closes the xml-subsystem.
SAX-reader encapsulation containing binary reader.
static void setHandler(GenericSAXHandler &handler)
Sets the given handler for the default reader.
static int myNextFreeReader
Information whether the reader is parsing.
virtual void clear()
Clears information whether an error occurred previously.
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
static void init()
Initialises the xml-subsystem.
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
static bool isValidating(const bool net=false)
Returns whether validation is enabled.
static XERCES_CPP_NAMESPACE::SAX2XMLReader::ValSchemes myValidationScheme
Information whether built reader/parser shall validate XML-documents against schemata.
const std::string & getFileName() const
returns the current file name
static MsgHandler * getErrorInstance()
Returns the instance to add errors to.
A handler which converts occuring elements and attributes into enums.
static SUMOSAXReader * getSAXReader(SUMOSAXHandler &handler)
Builds a reader and assigns the handler to it.
void setFileName(const std::string &name)
Sets the current file name.
static XERCES_CPP_NAMESPACE::SAX2XMLReader::ValSchemes myNetValidationScheme
Information whether built reader/parser shall validate SUMO networks against schemata.