SUMO - Simulation of Urban MObility
XMLSubSys.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2002-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // Utility methods for initialising, closing and using the XML-subsystem
19 /****************************************************************************/
20 #ifndef XMLSubSys_h
21 #define XMLSubSys_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <xercesc/sax2/SAX2XMLReader.hpp>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class GenericSAXHandler;
41 class SUMOSAXHandler;
42 class SUMOSAXReader;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
72 class XMLSubSys {
73 public:
82  static void init();
83 
84 
93  static void setValidation(const std::string& validationScheme, const std::string& netValidationScheme);
94 
95 
101  static void close();
102 
103 
115  static SUMOSAXReader* getSAXReader(SUMOSAXHandler& handler);
116 
117 
125  static void setHandler(GenericSAXHandler& handler);
126 
127 
146  static bool runParser(GenericSAXHandler& handler,
147  const std::string& file, const bool isNet = false);
148 
149 
150 private:
152  static std::vector<SUMOSAXReader*> myReaders;
153 
155  static int myNextFreeReader;
156 
158  static XERCES_CPP_NAMESPACE::SAX2XMLReader::ValSchemes myValidationScheme;
159 
161  static XERCES_CPP_NAMESPACE::SAX2XMLReader::ValSchemes myNetValidationScheme;
162 
163 };
164 
165 
166 #endif
167 
168 /****************************************************************************/
169 
static void init()
Initialises the xml-subsystem.
Definition: XMLSubSys.cpp:53
static void close()
Closes the xml-subsystem.
Definition: XMLSubSys.cpp:87
static void setValidation(const std::string &validationScheme, const std::string &netValidationScheme)
Enables or disables validation.
Definition: XMLSubSys.cpp:64
SAX-reader encapsulation containing binary reader.
Definition: SUMOSAXReader.h:57
static int myNextFreeReader
Information whether the reader is parsing.
Definition: XMLSubSys.h:155
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&#39;s ok.
Definition: XMLSubSys.cpp:109
A handler which converts occuring elements and attributes into enums.
static XERCES_CPP_NAMESPACE::SAX2XMLReader::ValSchemes myValidationScheme
Information whether built reader/parser shall validate XML-documents against schemata.
Definition: XMLSubSys.h:158
static SUMOSAXReader * getSAXReader(SUMOSAXHandler &handler)
Builds a reader and assigns the handler to it.
Definition: XMLSubSys.cpp:97
static void setHandler(GenericSAXHandler &handler)
Sets the given handler for the default reader.
Definition: XMLSubSys.cpp:103
static XERCES_CPP_NAMESPACE::SAX2XMLReader::ValSchemes myNetValidationScheme
Information whether built reader/parser shall validate SUMO networks against schemata.
Definition: XMLSubSys.h:161
Utility methods for initialising, closing and using the XML-subsystem.
Definition: XMLSubSys.h:72
static std::vector< SUMOSAXReader * > myReaders
The XML Readers used for repeated parsing.
Definition: XMLSubSys.h:152