if (elem.getAttribute("isNull") != null) {
if (elem.getAttributeValue("isNull").toLowerCase().equals("true"))
return null;
}
MemFile memFile = new MemFile();
List children = elem.getChildren();
Element child;
for (int i=0; i<children.size(); i++) {
child = (Element)children.get(i);
String name = child.getName().toLowerCase();
if (name.equals("name"))
memFile.setName(child.getText());
else if (name.equals("content")) {
String encoding = child.getAttributeValue("encoding");
if (encoding == null)
encoding = this.defaultEncoding;
TextSerializer encoder = getEncoder(encoding);
try {
byte [] content = (byte [])encoder.read(child.getText());
memFile.setContent(content);
}
catch(ParseException e) {
throw new IOException(e.getMessage());
}
}