robertjanetzko / LegendsBrowser

Legends Browser is an multi-platform, open source, java-based legends viewer for dwarf fortress 0.42.
MIT License
63 stars 19 forks source link

[BUG] nicknames containing the '&' character cause org.xml.sax.SAXParseException #29

Closed matt32106 closed 4 years ago

matt32106 commented 5 years ago

Hi, Ubuntu 18.04 LTS, LNP 44.12.r02.

I did open-legends then exportlegends info in DFHack console. When I try to open the resulting xml file in the browser, it displays loading legends.xml... but nothing happens afterwards. I have found the following in the log:

[2019-01-01 17:50:32] INFO: server started on localhost:58881
[2019-01-01 17:50:53] INFO: legendsPath:       /home/hippo/Desktop/LinuxLNP-0.44.12-r02/df_linux/region1-00133-07-09-legends.xml
legendsPlusPath:   /home/hippo/Desktop/LinuxLNP-0.44.12-r02/df_linux/region1-00133-07-09-legends_plus.xml
worldGenPath       /home/hippo/Desktop/LinuxLNP-0.44.12-r02/df_linux/region1-world_gen_param.txt
historyPath:       /home/hippo/Desktop/LinuxLNP-0.44.12-r02/df_linux/region1-00133-07-09-world_history.txt
sitesAndPropsPath: /home/hippo/Desktop/LinuxLNP-0.44.12-r02/df_linux/region1-00133-07-09-world_sites_and_pops.txt
imagePath:         /home/hippo/Desktop/LinuxLNP-0.44.12-r02/df_linux/region1-00133-07-09-detailed.bmp

[2019-01-01 17:50:53] INFO: load legends: /home/hippo/Desktop/LinuxLNP-0.44.12-r02/df_linux/region1-00133-07-09-legends.xml
[2019-01-01 17:50:53] WARNING: site - unknown element: rectangle = 295,1877:297,1879
[2019-01-01 17:50:53] WARNING: structure - unknown element: local_id = 0
[2019-01-01 17:50:53] WARNING: structure - unknown element: subtype = catacombs
[2019-01-01 17:50:53] WARNING: structure - unknown element: copied_artifact_id = 12
[2019-01-01 17:50:53] WARNING: artifact - unknown element: name_string = mamgozom ibmat lisid
[2019-01-01 17:50:53] WARNING: artifact - unknown element: site_id = 60
[2019-01-01 17:50:53] WARNING: artifact - unknown element: structure_local_id = 0
[2019-01-01 17:50:53] WARNING: artifact - unknown element: holder_hfid = 1366
[2019-01-01 17:50:53] WARNING: artifact - unknown element: subregion_id = 543
[2019-01-01 17:50:54] WARNING: historical_figure - unknown element: relationship_profile_hf_visual = 100
[2019-01-01 17:50:54] WARNING: entity_reputation - unknown element: rep_treasure_hunter = 150
[2019-01-01 17:50:54] WARNING: entity_reputation - unknown element: rep_knowledge_preserver = 50
[2019-01-01 17:50:54] SEVERE: error loading legends
org.xml.sax.SAXParseException; lineNumber: 1383533; columnNumber: 23; The reference to entity "bookeeper" must end with the ';' delimiter.
    at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1239)
    at legends.LegendsReader.read(LegendsReader.java:37)
    at legends.model.World$1.run(World.java:476)

`

lethosor commented 5 years ago

Is it possible that you've nicknamed a unit "&bookeeper" or something similar?

lethosor commented 5 years ago

bookeeper is what's in the original error (one k, not two). Can you search for that?

matt32106 commented 5 years ago
hippo@hippo-camp:~/Desktop/LinuxLNP-0.44.12-r02/df_linux$ grep -n "bookeeper" region1-00133-07-09-legends.xml 
1079837:        <name>`bookeeper' oilystopped</name>
1404558:        <name>`mgr&bookeeper' swelteredbook</name>
matt32106 commented 5 years ago

Problem is I can't find this name in DF interface to change it.

lethosor commented 5 years ago

It might be from an older fort. You should be able to replace & with &amp; to work around it. In any case, this looks like a DF bug to me, but exportlegends probably has a similar bug. Maybe LegendsBrowser could work around it too somehow.

matt32106 commented 5 years ago

Workaround: I used vim to replace the & in names by a space and the file loads OK.

lethosor commented 4 years ago

Looked at this when I was working on https://github.com/DFHack/dfhack/issues/1418 - this line in your logs indicates to me that this is a DF issue (i.e. DFHack doesn't generate the file in question), so it should probably be reported on Mantis:

[2019-01-01 17:50:53] INFO: load legends: /home/hippo/Desktop/LinuxLNP-0.44.12-r02/df_linux/region1-00133-07-09-legends.xml