Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Problem with xml2csv.py

Hi Reza,

it works for me (under Linux and with the latest development version). The delimiter is a semicolon.

This is the output with schema:

==> tripinfo.csv <==
tripinfo_id;tripinfo_depart;tripinfo_departLane;tripinfo_departPos;tripinfo_departPosLat;tripinfo_departSpeed;tripinfo_departDelay;tripinfo_arrival;tripinfo_arrivalLane;tripinfo_arrivalPos;tripinfo_arrivalPosLat;tripinfo_arrivalSpeed;tripinfo_duration;tripinfo_routeLength;tripinfo_waitingTime;tripinfo_waitingCount;tripinfo_stopTime;tripinfo_timeLoss;tripinfo_rerouteNo;tripinfo_devices;tripinfo_vType;tripinfo_speedFactor;tripinfo_vaporized;example_device_customValue1;example_device_customValue2;emissions_CO_abs;emissions_CO2_abs;emissions_HC_abs;emissions_PMx_abs;emissions_NOx_abs;emissions_fuel_abs;emissions_electricity_abs;taxi_customers;taxi_occupiedDistance;taxi_occupiedTime;personinfo_id;personinfo_depart;personinfo_type;ride_waitingTime;ride_vehicle;ride_depart;ride_arrival;ride_arrivalPos;ride_duration;ride_routeLength;ride_timeLoss;walk_depart;walk_departPos;walk_arrival;walk_arrivalPos;walk_duration;walk_routeLength;walk_timeLoss;walk_maxSpeed;access_stop;access_duration;access_routeLength;containerinfo_id;containerinfo_depart;containerinfo_type;stop_duration;stop_arrival;stop_arrivalPos;stop_actType;transport_waitingTime;transport_vehicle;transport_depart;transport_arrival;transport_arrivalPos;transport_duration;transport_routeLength;transport_timeLoss;tranship_depart;tranship_departPos;tranship_arrival;tranship_arrivalPos;tranship_duration;tranship_routeLength;tranship_maxSpeed
f1.0;0.00;e1_0;5.10;0.00;0.00;0.00;160.00;e1_0;800.00;0.00;5.00;160.00;794.90;0.00;0;0.00;17.24;0;tripinfo_f1.0 fcd_f1.0;car@f1.0;1.12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; f1.1;1.00;e1_1;5.10;0.00;0.00;0.33;161.00;e1_1;800.00;0.00;5.00;160.00;794.90;0.00;0;0.00;19.36;0;tripinfo_f1.1 fcd_f1.1;car@f1.1;1.13;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

This without schema
==> tripinfo.csv2.csv <==
tripinfo_arrival;tripinfo_arrivalLane;tripinfo_arrivalPos;tripinfo_arrivalPosLat;tripinfo_arrivalSpeed;tripinfo_depart;tripinfo_departDelay;tripinfo_departLane;tripinfo_departPos;tripinfo_departPosLat;tripinfo_departSpeed;tripinfo_devices;tripinfo_duration;tripinfo_id;tripinfo_rerouteNo;tripinfo_routeLength;tripinfo_speedFactor;tripinfo_stopTime;tripinfo_timeLoss;tripinfo_vType;tripinfo_vaporized;tripinfo_waitingCount;tripinfo_waitingTime
160.00;e1_0;800.00;0.00;5.00;0.00;0.00;e1_0;5.10;0.00;0.00;tripinfo_f1.0 fcd_f1.0;160.00;f1.0;0;794.90;1.12;0.00;17.24;car@f1.0;;0;0.00 161.00;e1_1;800.00;0.00;5.00;1.00;0.33;e1_1;5.10;0.00;0.00;tripinfo_f1.1 fcd_f1.1;160.00;f1.1;0;794.90;1.13;0.00;19.36;car@f1.1;;0;0.00

I have used this command

xml2csv.py --xsd $SUMO_HOME/data/xsd/tripinfo_file.xsd --validation tripinfo.xml

In the windows world you might use

xml2csv.py --xsd %SUMO_HOME%\data\xsd\tripinfo_file.xsd --validation tripinfo.xml

Please note, that tripinfo needs baseTypes.xsd.

Regards, Harald


Am 14.07.20 um 01:39 schrieb MohamadReza-Haghani:
Thanks. I did accordingly and installed lxml. Now when I run the command
"python xml2csv.py tripinfo.xml --xsd=tripinfo.xsd --validation," it does
not show any error. However, the same problem still exists that all of the
attributes for a vehicle are in a single cell in the csv file. I would like
to know why schema did not work. Please find attached the used files.
-Reza

ezyzip.zip
<http://sumo-user-mailing-list.90755.n8.nabble.com/file/t374/ezyzip.zip>



--
Sent from: http://sumo-user-mailing-list.90755.n8.nabble.com/
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user



Back to the top