I think the XML file wound up being enough, actually - I just needed to figure out which of the 11 places an item_subtype tag is produced was causing the issue (turns out it was most of them), and the single line in Legends Viewer's error message wasn't enough to determine that. By the way, your file included around 1.2 GB of bitmaps, which I would have preferred to avoid downloading (but they compressed well enough so it's not a big deal).
Here is an updated version of the script that should address the issue (click the "Raw" button to download). I didn't actually load your save, but I changed line 3444060 (wow!) manually, and that was the only change needed for xmllint to accept the file, so I think that should fix it. Let me know if it works for you.
Oops, 1.2 GB? Today I learned the difference between "info" and "all". Sorry about that, upload was <100MB so I didn't stop to think.
The output from the updated script is accepted by my Firefox browser, i.e. I can confirm it is well formed XML (at least for some value of "well formed"). The legends_plus file is still not recognised as such by Legends Viewer. This may be an issue with Legends Viewer, I'll see what I can find.
Certainly the file has many entries: though the world is not that large, it is several hundred years old. A file compare (on the textual level using notepad++) showed that the differences between the legends_plus files produced were all to do with the letters 'ö' and 'å'. Replacing these with 'oe' / 'aa' did not result in Legends Viewer accepting the legends_plus file.
Further, Legends Viewer also report site ownership conflicts in the input it accepted an processed, not that I know if that has anything to do with my current issue.