Closed stephengold closed 1 year ago
added TestIssue2068
to master-branch jme3-examples at b5623697acf2597f7d69cad6ca48f8e11899dcc8
Some additional info: It seems to happen because UserData.writeList() writes the size of the list under a key starting with the listName argument. https://github.com/jMonkeyEngine/jmonkeyengine/blob/230f1575bf9935b47cb8ecdcd8ddc7379c56e75b/jme3-core/src/main/java/com/jme3/scene/UserData.java#L258
UserData.write() calls UserData.writeList() with numbers for the listName when writing lists, arrays, and maps (all affected by this bug.) XML attribute names (or any names I think...) cannot begin with a number.
This problem could be fixed by substituting "0" and "1" for "A" and "B" in the read and write methods, except that would break backwards compatibility for binary files. I noticed the xml includes format_version
property on the root node... could that be utilized to keep backwrds compatibility?
I noticed the xml includes format_version property on the root node... could that be utilized to keep backwrds compatibility?
Why not? But i think a more solid approach would be to prefix every key with "jme-" in the xml importer/exporter
The jme3-plugins sub-project provides an
XMLExporter
class to export savables to XML files.However, if the
Savable
includes a non-emptyMap
, invoking thesave()
method causesCoreDocumentImpl.createAttribute()
to throw aDOMException
.Test code:
Typical result:
Note that the
BinaryExporter
class seems to handle maps just fine.