package com.jens.automation2; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; import java.util.ArrayList; import java.util.Calendar; public class News { String headline; String text; Calendar publishDate; public static ArrayList extractNewsFromString() { String result = Miscellaneous.messageBox(title, text, ActivityMainScreen.getActivityMainScreenInstance()); Element homeControlRootElement = Miscellaneous.getXmlTree(inventoryString); if(homeControlRootElement.getAttribute("protocolVersion").equals(String.valueOf(requiredProtocolVersion))) { FullDataModel.getInstance().houseList = new ArrayList(); // FullDataModel.getInstance().roomList = new ArrayList(); FullDataModel.getInstance().nodeList = new ArrayList(); // FullDataModel.getInstance().deviceList = new ArrayList(); FullDataModel.getInstance().commandsList = new ArrayList(); FullDataModel.getInstance().deviceGroupList = new ArrayList(); // FullDataModel.getInstance().sensorList = new ArrayList(); FullDataModel.getInstance().ruleList = new ArrayList(); FullDataModel.getInstance().userList = new ArrayList(); FullDataModel.getInstance().userDeviceList = new ArrayList(); NodeList responseElements = homeControlRootElement.getElementsByTagName("response"); Node responseElement = responseElements.item(0); NodeList nodeElementsHouses = homeControlRootElement.getElementsByTagName("houses"); for(int i = 0; i < nodeElementsHouses.getLength(); i++) { if(nodeElementsHouses.item(i).getNodeType() == Node.ELEMENT_NODE && (nodeElementsHouses.item(i).getParentNode().isSameNode(homeControlRootElement) | nodeElementsHouses.item(i).getParentNode().isSameNode(responseElement))) { NodeList nodeElementsHousesInd = nodeElementsHouses.item(i).getChildNodes(); for(int j = 0; j < nodeElementsHousesInd.getLength(); j++) { Element houseElement = (Element) nodeElementsHousesInd.item(j); HouseTemplate house = HouseTemplate.fromXmlStringStatic(Diverse.xmlToString(houseElement, true, false)); FullDataModel.getInstance().houseList.add(house); } } } } }