PedestrianDynamics / jupedsim

JuPedSim is an open source pedestrian dynamics simulator
http://jupedsim.org
Other
39 stars 27 forks source link

XML Schema, Error reading Attributes #807

Closed gjaeger closed 4 years ago

gjaeger commented 4 years ago

Some jpscore and jpsreport ini files contain different information about the XML schema, like

jpscore/demos/01_corridor/corridor_ini.xml

<?xml version="1.0" encoding="UTF-8" ?>

<JuPedSim project="JPS-Project" version="0.7"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

jpsreport/demos/bottleneck/ini_AO_300.xml

<?xml version="1.0" encoding="UTF-8"?>
<JPSreport project="AO_300" version="0.8.5" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Earlier versions contained additional elements and enabled validation (based on an old pdf-documentation):

<?xml version=" 1.0" encoding="UTF-8" ?>

<JPSreport project="JPS-Project" version="0.8" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://github.com/JuPedSim/jpsreport/blob/develop/xsd/jps_report.xsd">

Due to a typo I got the following error message when starting a simulation with jpscore:

[2020-06-29 09:54:50.831] [info] Loading and parsing the project file <inifile.xml>
[2020-06-29 09:54:50.833] [error] Error reading Attributes.
[2020-06-29 09:54:50.833] [error] Exception in IniFileParser::Parse thrown, what: Could not parse the project file

The error message is not very helpful for searching and correcting.

In an earlier version I got the information in which attribute the error is located. This would be very helpful for the future application. What are the options to localize the reason for the error?

chraibi commented 4 years ago

I think we decided at some point to stop using xsd-schemes since we don't have any easy way to programmatically use them to verify XML files. (@schroedtert right?)

I know that these XML-error messages are not easy to decipher, but maybe two solutions could help mitigate this problem:

  1. Use an online validator: example
  2. Use a good Editor like for example Emacs :-)
Screenshot 2020-07-21 12 21 14
schroedtert commented 4 years ago

I think we decided at some point to stop using xsd-schemes since we don't have any easy way to programmatically use them to verify XML files.

Yes, we decided to not put any work into these as they had already diverged quite a lot from the actutal parsed input. And I'm not sure if the xsd file would work in such cases, I would also propose to use any text editor (atom, notepad++, ...) that can properly deal with xml files.

gjaeger commented 4 years ago

@chraibi @schroedtert Thank you for your comments. From my side, I propose to close the issue. There are no further activities planned/desired.

chraibi commented 4 years ago

For future reference #436