matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
80 stars 177 forks source link

Error: Attribute "carAvail" must be declared for element type "person". #607

Closed jalal1 closed 2 years ago

jalal1 commented 3 years ago

When I add "carAvail" to the 'person' element, I received the following error. I am not sure what's wrong. Is it related to carsharing module ?

I also tried this attribute: "car_avail", but the same error.

image

Attribute "carAvail" must be declared for element type "person".
Attribute "carAvail" must be declared for element type "person".

XML-ERROR: file:/C:/Users/Jalal/Documents/matsim-libs-master-0.13/contribs/carsharing/test/input/org/matsim/contrib/carsharing/runExample/debug_p_1439/plans.xml, line 31, column 38:
org.xml.sax.SAXParseException; systemId: file:/C:/Users/Jalal/Documents/matsim-libs-master-0.13/contribs/carsharing/test/input/org/matsim/contrib/carsharing/runExample/debug_p_1439/plans.xml; lineNumber: 31; columnNumber: 38; Attribute "carAvail" must be declared for element type "person".
Exception in thread "main" org.matsim.core.utils.io.UncheckedIOException: org.xml.sax.SAXParseException; systemId: file:/C:/Users/Jalal/Documents/matsim-libs-master-0.13/contribs/carsharing/test/input/org/matsim/contrib/carsharing/runExample/debug_p_1439/plans.xml; lineNumber: 31; columnNumber: 38; Attribute "carAvail" must be declared for element type "person".
    at org.matsim.core.utils.io.MatsimXmlParser.parse(MatsimXmlParser.java:199)
    at org.matsim.core.utils.io.MatsimXmlParser.parse(MatsimXmlParser.java:169)
    at org.matsim.core.scenario.ScenarioLoaderImpl.loadPopulation(ScenarioLoaderImpl.java:202)
    at org.matsim.core.scenario.ScenarioLoaderImpl.loadScenario(ScenarioLoaderImpl.java:115)
    at org.matsim.core.scenario.ScenarioUtils.loadScenario(ScenarioUtils.java:79)
    at org.matsim.contrib.carsharing.runExample.RunCarsharing.main(RunCarsharing.java:76)
balacmi commented 3 years ago

It is not related to the carsharing module. After some point in the past, carAvail is no longer added as an attribute of a person, but you can add it in the list of attributes. Something like this: <person id="1"> <attributes> <attribute name="carAvail" class="java.lang.String">always</attribute> </attributes> </person>

I hope this helps.

jalal1 commented 3 years ago

@balacmi I appreciate your reply. I will try it out.

Thank you.