Class XmlNetworkLaneParser
- java.lang.Object
-
- org.opentrafficsim.road.network.factory.xml.parser.XmlNetworkLaneParser
-
- All Implemented Interfaces:
Serializable
public final class XmlNetworkLaneParser extends Object implements Serializable
Parse an XML file for an OTS network, based on the ots-network.xsd definition.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
$LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $, initial version Jul 23, 2015
BSD-style license. See OpenTrafficSim License.- Author:
- Alexander Verbraeck
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Experiment.TimeDoubleUnit<OTSSimulatorInterface>build(InputStream xmlStream, OTSRoadNetwork otsNetwork, boolean buildConflicts)Parse the XML input stream and build the network.static OTSRoadNetworkbuild(String filename, OTSRoadNetwork otsNetwork, boolean buildConflicts)Parse the XML file and build the network.static Experiment.TimeDoubleUnit<OTSSimulatorInterface>build(URL xmlURL, OTSRoadNetwork otsNetwork, boolean buildConflicts)Parse the XML file and build the network.static Experiment.TimeDoubleUnit<OTSSimulatorInterface>build(OTS ots, OTSRoadNetwork otsNetwork, boolean buildConflicts)Build the network from an OTS object (probably constructed by parsing an OTS XML file; e.g.static voidmain(String[] args)static OTSparseXML(InputStream xmlStream)Parse an OTS XML input stream and build an OTS object.static OTSparseXML(URL xmlURL)Parse an OTS XML input stream and build an OTS object.
-
-
-
Method Detail
-
build
public static OTSRoadNetwork build(String filename, OTSRoadNetwork otsNetwork, boolean buildConflicts) throws javax.xml.bind.JAXBException, URISyntaxException, NetworkException, OTSGeometryException, XmlParserException, SAXException, ParserConfigurationException, SimRuntimeException, GTUException, MalformedURLException, IOException, TrafficControlException
Parse the XML file and build the network.- Parameters:
filename- String; the name of the file to parseotsNetwork- OTSRoadNetwork; the network to insert the parsed objects inbuildConflicts- boolean; whether to build conflicts or not- Returns:
- the network that contains the parsed objects
- Throws:
javax.xml.bind.JAXBException- when the parsing failsURISyntaxException- when the filename is not validNetworkException- when the objects cannot be inserted into the network due to inconsistenciesOTSGeometryException- when the design line of a link is invalidXmlParserException- when the stripe type cannot be recognizedParserConfigurationException- on error with parser configurationSAXException- on error creating SAX parserSimRuntimeException- in case of simulation problems building the car generatorGTUException- when construction of the Strategical Planner failedTrafficControlException- when construction of a traffic controller failsIOException- when construction of a traffic controller failsMalformedURLException- when construction of a traffic controller fails
-
build
public static Experiment.TimeDoubleUnit<OTSSimulatorInterface> build(InputStream xmlStream, OTSRoadNetwork otsNetwork, boolean buildConflicts) throws javax.xml.bind.JAXBException, URISyntaxException, NetworkException, OTSGeometryException, XmlParserException, SAXException, ParserConfigurationException, SimRuntimeException, GTUException, MalformedURLException, IOException, TrafficControlException
Parse the XML input stream and build the network.- Parameters:
xmlStream- InputStream; the xml input streamotsNetwork- OTSRoadNetwork; the network to insert the parsed objects inbuildConflicts- boolean; whether to build conflicts or not- Returns:
- the experiment based on the information in the RUN tag
- Throws:
javax.xml.bind.JAXBException- when the parsing failsURISyntaxException- when the filename is not validNetworkException- when the objects cannot be inserted into the network due to inconsistenciesOTSGeometryException- when the design line of a link is invalidXmlParserException- when the stripe type cannot be recognizedParserConfigurationException- on error with parser configurationSAXException- on error creating SAX parserSimRuntimeException- in case of simulation problems building the car generatorGTUException- when construction of the Strategical Planner failedTrafficControlException- when construction of a traffic controller failsIOException- when construction of a traffic controller failsMalformedURLException- when construction of a traffic controller fails
-
parseXML
public static OTS parseXML(URL xmlURL) throws javax.xml.bind.JAXBException, SAXException, ParserConfigurationException
Parse an OTS XML input stream and build an OTS object.- Parameters:
xmlURL- URL; the URL for the xml file or stream- Returns:
- OTS; the constructed OTS object
- Throws:
javax.xml.bind.JAXBException- when the parsing failsParserConfigurationException- on error with parser configurationSAXException- on error creating SAX parser
-
parseXML
public static OTS parseXML(InputStream xmlStream) throws javax.xml.bind.JAXBException, SAXException, ParserConfigurationException
Parse an OTS XML input stream and build an OTS object.- Parameters:
xmlStream- inputStream; the xml stream- Returns:
- OTS; the constructed OTS object
- Throws:
javax.xml.bind.JAXBException- when the parsing failsParserConfigurationException- on error with parser configurationSAXException- on error creating SAX parser
-
build
public static Experiment.TimeDoubleUnit<OTSSimulatorInterface> build(URL xmlURL, OTSRoadNetwork otsNetwork, boolean buildConflicts) throws javax.xml.bind.JAXBException, URISyntaxException, NetworkException, OTSGeometryException, XmlParserException, SAXException, ParserConfigurationException, SimRuntimeException, GTUException, MalformedURLException, IOException, TrafficControlException
Parse the XML file and build the network.- Parameters:
xmlURL- URL; the URL for the xml input fileotsNetwork- OTSRoadNetwork; the network to insert the parsed objects inbuildConflicts- boolean; whether to build conflicts or not- Returns:
- the experiment based on the information in the RUN tag
- Throws:
javax.xml.bind.JAXBException- when the parsing failsURISyntaxException- when the filename is not validNetworkException- when the objects cannot be inserted into the network due to inconsistenciesOTSGeometryException- when the design line of a link is invalidXmlParserException- when the stripe type cannot be recognizedParserConfigurationException- on error with parser configurationSAXException- on error creating SAX parserSimRuntimeException- in case of simulation problems building the car generatorGTUException- when construction of the Strategical Planner failedTrafficControlException- when construction of a traffic controller failsIOException- when construction of a traffic controller failsMalformedURLException- when construction of a traffic controller fails
-
build
public static Experiment.TimeDoubleUnit<OTSSimulatorInterface> build(OTS ots, OTSRoadNetwork otsNetwork, boolean buildConflicts) throws javax.xml.bind.JAXBException, URISyntaxException, NetworkException, OTSGeometryException, XmlParserException, SAXException, ParserConfigurationException, SimRuntimeException, GTUException, MalformedURLException, IOException, TrafficControlException
Build the network from an OTS object (probably constructed by parsing an OTS XML file; e.g. the parseXML method).- Parameters:
ots- OTS; the OTS objectotsNetwork- OTSRoadNetwork; the network to insert the parsed objects inbuildConflicts- boolean; whether to build conflicts or not- Returns:
- the experiment based on the information in the RUN tag
- Throws:
javax.xml.bind.JAXBException- when the parsing failsURISyntaxException- when the filename is not validNetworkException- when the objects cannot be inserted into the network due to inconsistenciesOTSGeometryException- when the design line of a link is invalidXmlParserException- when the stripe type cannot be recognizedParserConfigurationException- on error with parser configurationSAXException- on error creating SAX parserSimRuntimeException- in case of simulation problems building the car generatorGTUException- when construction of the Strategical Planner failedTrafficControlException- when construction of a traffic controller failsIOException- when construction of a traffic controller failsMalformedURLException- when construction of a traffic controller fails
-
-