public static Generator loadFromXML(Element data) { ItemList retVal = new ItemList(); Elements nodes = data.getElements(); while (nodes.hasMoreElements()) { Element node = nodes.next(); String nodeName = node.getName(); switch (nodeName) { case "listType": retVal.setListType(Integer.parseInt(node.getTextString())); break; case "listItems": Elements items = node.getElements(); while (items.hasMoreElements()) { Element itemNode = items.next(); String itemNodeName = itemNode.getName(); if (itemNodeName.equals("item")) { retVal.listItems.add(Double.valueOf(itemNode.getTextString())); } } break; case "index": retVal.index = Integer.parseInt(node.getTextString()); break; case "direction": retVal.direction = Integer.parseInt(node.getTextString()); break; } } return retVal; }
public static UserDefinedOpcode loadFromXML(Element data) { UserDefinedOpcode retVal = new UserDefinedOpcode(); Elements nodes = data.getElements(); while (nodes.hasMoreElements()) { Element node = nodes.next(); String val = node.getTextString(); if (val == null) { val = ""; } switch (node.getName()) { case "opcodeName": retVal.opcodeName = val; break; case "outTypes": retVal.outTypes = val; break; case "inTypes": retVal.inTypes = val; break; case "codeBody": retVal.codeBody = val; break; case "comments": retVal.comments = val; break; } } return retVal; }
public static BSBObject loadFromXML(Element data) { BSBLabel label = new BSBLabel(); initBasicFromXML(data, label); label.setLabel(data.getTextString("label")); return label; }