mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Fix so array indices can be saved to XML
This commit is contained in:
@@ -85,7 +85,7 @@ public class XmlReader {
|
||||
@Override
|
||||
public Void evaluate() {
|
||||
try {
|
||||
Integer arrayIndex = Integer.valueOf(currentElement.getTagName());
|
||||
Integer arrayIndex = Integer.valueOf(currentElement.getTagName().substring(1)); //trim "i" prefix
|
||||
if (arrayIndex >= 0 && arrayIndex < array.length) {
|
||||
V value = builder.evaluate();
|
||||
if (value != null) {
|
||||
|
||||
@@ -88,7 +88,7 @@ public class XmlWriter {
|
||||
public void write(String key, IXmlWritable[] value) {
|
||||
startElement(key);
|
||||
for (int i = 0; i < value.length; i++) {
|
||||
write(String.valueOf(i), value[i]);
|
||||
write("i" + i, value[i]); //must prefix with "i" since numbers are invalid XML tag names
|
||||
}
|
||||
endElement();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user