mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38: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
|
@Override
|
||||||
public Void evaluate() {
|
public Void evaluate() {
|
||||||
try {
|
try {
|
||||||
Integer arrayIndex = Integer.valueOf(currentElement.getTagName());
|
Integer arrayIndex = Integer.valueOf(currentElement.getTagName().substring(1)); //trim "i" prefix
|
||||||
if (arrayIndex >= 0 && arrayIndex < array.length) {
|
if (arrayIndex >= 0 && arrayIndex < array.length) {
|
||||||
V value = builder.evaluate();
|
V value = builder.evaluate();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class XmlWriter {
|
|||||||
public void write(String key, IXmlWritable[] value) {
|
public void write(String key, IXmlWritable[] value) {
|
||||||
startElement(key);
|
startElement(key);
|
||||||
for (int i = 0; i < value.length; i++) {
|
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();
|
endElement();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user