Added support for serializing scalar values to "item" tag.

This commit is contained in:
Ryszard Wiśniewski 2010-03-13 12:04:07 +01:00
parent 6634963ab8
commit 99ec06d40c

View File

@ -37,8 +37,14 @@ public abstract class ResScalarValue extends ResValue
public void serializeToXml(XmlSerializer serializer, ResResource res) public void serializeToXml(XmlSerializer serializer, ResResource res)
throws IOException, AndrolibException { throws IOException, AndrolibException {
String tagName = res.getResSpec().getType().getName(); String type = res.getResSpec().getType().getName();
boolean item = ! type.equals(mType);
String tagName = item ? "item" : type;
serializer.startTag(null, tagName); serializer.startTag(null, tagName);
if (item) {
serializer.attribute(null, "type", type);
}
serializer.attribute(null, "name", res.getResSpec().getName()); serializer.attribute(null, "name", res.getResSpec().getName());
serializer.text(toResXmlFormat()); serializer.text(toResXmlFormat());
serializer.endTag(null, tagName); serializer.endTag(null, tagName);