Fix so array indices can be saved to XML

This commit is contained in:
drdev
2016-01-02 03:10:22 +00:00
parent f3b528cfa7
commit 665bb60ef2
2 changed files with 2 additions and 2 deletions

View File

@@ -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) {

View File

@@ -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();
}