diff --git a/sumo/src/activitygen/activitygen_main.cpp b/sumo/src/activitygen/activitygen_main.cpp index eb111cc542f6..3a6b2ad22cd8 100644 --- a/sumo/src/activitygen/activitygen_main.cpp +++ b/sumo/src/activitygen/activitygen_main.cpp @@ -120,7 +120,7 @@ main(int argc, char* argv[]) { } std::string statFile = oc.getString("stat-file"); - OutputDevice::createDeviceByOption("output-file", "routes"); + OutputDevice::createDeviceByOption("output-file", "routes", "routes_file.xsd"); AGTime duration(1, 0, 0); AGTime begin(0); AGTime end(0); diff --git a/sumo/src/dfrouter/RODFDetector.cpp b/sumo/src/dfrouter/RODFDetector.cpp index e28c38fb3a39..ae66ae190372 100644 --- a/sumo/src/dfrouter/RODFDetector.cpp +++ b/sumo/src/dfrouter/RODFDetector.cpp @@ -632,7 +632,7 @@ RODFDetectorCon::writeEmitters(const std::string& file, } // OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional"); + out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\""); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { RODFDetector* det = *i; // get file name for values (emitter/calibrator definition) @@ -674,7 +674,7 @@ void RODFDetectorCon::writeEmitterPOIs(const std::string& file, const RODFDetectorFlows& flows) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional"); + out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\""); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { RODFDetector* det = *i; SUMOReal flow = flows.getFlowSumSecure(det->getID()); @@ -753,7 +753,7 @@ RODFDetectorCon::writeSpeedTrigger(const RODFNet* const net, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional"); + out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\""); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { RODFDetector* det = *i; // write the declaration into the file @@ -771,7 +771,7 @@ RODFDetectorCon::writeSpeedTrigger(const RODFNet* const net, void RODFDetectorCon::writeEndRerouterDetectors(const std::string& file) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("additional"); + out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\""); for (std::vector::const_iterator i = myDetectors.begin(); i != myDetectors.end(); ++i) { RODFDetector* det = *i; // write the declaration into the file diff --git a/sumo/src/microsim/MSFrame.cpp b/sumo/src/microsim/MSFrame.cpp index b2602c129def..a364d8974c24 100644 --- a/sumo/src/microsim/MSFrame.cpp +++ b/sumo/src/microsim/MSFrame.cpp @@ -334,15 +334,15 @@ MSFrame::fillOptions() { void MSFrame::buildStreams() { // standard outputs - OutputDevice::createDeviceByOption("netstate-dump", "netstate"); - OutputDevice::createDeviceByOption("summary-output", "summary"); - OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos"); + OutputDevice::createDeviceByOption("netstate-dump", "netstate", "netstate_file.xsd"); + OutputDevice::createDeviceByOption("summary-output", "summary", "summary_file.xsd"); + OutputDevice::createDeviceByOption("tripinfo-output", "tripinfos", "tripinfo_file.xsd"); //extended - OutputDevice::createDeviceByOption("fcd-output", "fcd-export"); - OutputDevice::createDeviceByOption("emission-output", "emission-export"); - OutputDevice::createDeviceByOption("full-output", "full-export"); - OutputDevice::createDeviceByOption("queue-output", "queue-export"); + OutputDevice::createDeviceByOption("fcd-output", "fcd-export", "fcd_file.xsd"); + OutputDevice::createDeviceByOption("emission-output", "emission-export", "emission_file.xsd"); + OutputDevice::createDeviceByOption("full-output", "full-export", "full_file.xsd"); + OutputDevice::createDeviceByOption("queue-output", "queue-export", "queue_file.xsd"); //OutputDevice::createDeviceByOption("vtk-output", "vtk-export"); OutputDevice::createDeviceByOption("link-output", "link-output"); diff --git a/sumo/src/microsim/devices/MSDevice_Vehroutes.cpp b/sumo/src/microsim/devices/MSDevice_Vehroutes.cpp index ec199ce22570..5d375598d748 100644 --- a/sumo/src/microsim/devices/MSDevice_Vehroutes.cpp +++ b/sumo/src/microsim/devices/MSDevice_Vehroutes.cpp @@ -65,7 +65,7 @@ std::map MSDevice_Vehroutes::myRouteInfos; void MSDevice_Vehroutes::init() { if (OptionsCont::getOptions().isSet("vehroute-output")) { - OutputDevice::createDeviceByOption("vehroute-output", "routes"); + OutputDevice::createDeviceByOption("vehroute-output", "routes", "routes_file.xsd"); mySaveExits = OptionsCont::getOptions().getBool("vehroute-output.exit-times"); myLastRouteOnly = OptionsCont::getOptions().getBool("vehroute-output.last-route"); mySorted = OptionsCont::getOptions().getBool("vehroute-output.sorted"); diff --git a/sumo/src/netload/NLHandler.cpp b/sumo/src/netload/NLHandler.cpp index 3d8dcc1b0daf..c7291afedf57 100644 --- a/sumo/src/netload/NLHandler.cpp +++ b/sumo/src/netload/NLHandler.cpp @@ -562,7 +562,7 @@ NLHandler::addPOI(const SUMOSAXAttributes& attrs) { if (laneID != "") { MSLane* lane = MSLane::dictionary(laneID); if (lane == 0) { - WRITE_ERROR("Lane '" + laneID + "' to place a poi '" + id + "'on is not known."); + WRITE_ERROR("Lane '" + laneID + "' to place poi '" + id + "' on is not known."); return; } if (lanePos < 0) { diff --git a/sumo/src/od2trips/od2trips_main.cpp b/sumo/src/od2trips/od2trips_main.cpp index 422aa8eb44f9..7b42a0711641 100644 --- a/sumo/src/od2trips/od2trips_main.cpp +++ b/sumo/src/od2trips/od2trips_main.cpp @@ -269,14 +269,14 @@ main(int argc, char** argv) { } // write bool haveOutput = false; - if (OutputDevice::createDeviceByOption("output-file", "routes")) { + if (OutputDevice::createDeviceByOption("output-file", "routes", "routes_file.xsd")) { matrix.write(string2time(oc.getString("begin")), string2time(oc.getString("end")), OutputDevice::getDeviceByOption("output-file"), oc.getBool("spread.uniform"), oc.getBool("ignore-vehicle-type"), oc.getString("prefix"), !oc.getBool("no-step-log")); haveOutput = true; } - if (OutputDevice::createDeviceByOption("flow-output", "routes")) { + if (OutputDevice::createDeviceByOption("flow-output", "routes", "routes_file.xsd")) { matrix.writeFlows(string2time(oc.getString("begin")), string2time(oc.getString("end")), OutputDevice::getDeviceByOption("flow-output"), oc.getBool("ignore-vehicle-type"), oc.getString("prefix")); diff --git a/sumo/src/polyconvert/PCPolyContainer.cpp b/sumo/src/polyconvert/PCPolyContainer.cpp index 22136781a8d4..4293b5b48cbc 100644 --- a/sumo/src/polyconvert/PCPolyContainer.cpp +++ b/sumo/src/polyconvert/PCPolyContainer.cpp @@ -154,7 +154,7 @@ PCPolyContainer::report() { void PCPolyContainer::save(const std::string& file) { OutputDevice& out = OutputDevice::getDevice(file); - out.writeXMLHeader("shapes"); + out.writeXMLHeader("additional", "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/additional_file.xsd\""); // write polygons for (PolyCont::iterator i = myPolyCont.begin(); i != myPolyCont.end(); ++i) { Polygon* p = i->second; diff --git a/sumo/src/utils/iodevices/OutputDevice.cpp b/sumo/src/utils/iodevices/OutputDevice.cpp index 8c13f25c74f7..bb5867e00844 100644 --- a/sumo/src/utils/iodevices/OutputDevice.cpp +++ b/sumo/src/utils/iodevices/OutputDevice.cpp @@ -96,14 +96,15 @@ OutputDevice::getDevice(const std::string& name) { bool OutputDevice::createDeviceByOption(const std::string& optionName, - const std::string& rootElement) { + const std::string& rootElement, + const std::string& schemaFile) { if (!OptionsCont::getOptions().isSet(optionName)) { return false; } OutputDevice& dev = OutputDevice::getDevice(OptionsCont::getOptions().getString(optionName)); if (rootElement != "") { - if (rootElement == "routes" || rootElement == "netstate") { - dev.writeXMLHeader(rootElement, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/" + rootElement + "_file.xsd\""); + if (schemaFile != "") { + dev.writeXMLHeader(rootElement, "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"http://sumo-sim.org/xsd/" + schemaFile + "\""); } else { dev.writeXMLHeader(rootElement); } diff --git a/sumo/src/utils/iodevices/OutputDevice.h b/sumo/src/utils/iodevices/OutputDevice.h index 578b413c7f88..2ebfae6fb9cb 100644 --- a/sumo/src/utils/iodevices/OutputDevice.h +++ b/sumo/src/utils/iodevices/OutputDevice.h @@ -97,13 +97,15 @@ class OutputDevice { * within XML-declarations of structures which paths already is aware of the * cwd. * - * @param[in] optionName The name of the option to use for retrieving the output definition + * @param[in] optionName The name of the option to use for retrieving the output definition * @param[in] rootElement The root element to use (XML-output) + * @param[in] schemaFile The basename of the schema file to use (XML-output) * @return Whether a device was built (the option was set) * @exception IOError If the output could not be built for any reason (error message is supplied) */ static bool createDeviceByOption(const std::string& optionName, - const std::string& rootElement = ""); + const std::string& rootElement = "", + const std::string& schemaFile = ""); /** @brief Returns the device described by the option