Browse Source

Removed some uses newsItemList.Group class

master
Defend 7 years ago
parent
commit
579290a8ee
  1. 19
      app/src/main/java/ru/defend/defdevteam/tstu/FeedParser.java

19
app/src/main/java/ru/defend/defdevteam/tstu/FeedParser.java

@ -16,11 +16,10 @@ import javax.xml.parsers.DocumentBuilderFactory;
public class FeedParser { public class FeedParser {
ParserCallback callback; ParserCallback callback;
NewsItemList newsItemList;
String inputXML; String inputXML;
interface ParserCallback { interface ParserCallback {
void onSuccessParsing(NewsItemList newsItemList); void onSuccessParsing();
void onFailureParsing(); void onFailureParsing();
} }
@ -29,13 +28,10 @@ public class FeedParser {
} }
FeedParser(String inputXML) { FeedParser(String inputXML) {
newsItemList = new NewsItemList();
this.inputXML = inputXML; this.inputXML = inputXML;
} }
void parseXML() { void parseXML() {
NewsItemList.Group group = new NewsItemList().new Group(); // <---Remove that
try { try {
DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
// Создается дерево DOM документа из файла // Создается дерево DOM документа из файла
@ -43,17 +39,14 @@ public class FeedParser {
// Получаем корневой элемент // Получаем корневой элемент
Node root = document.getDocumentElement(); Node root = document.getDocumentElement();
String exp = root.getTextContent(); // <---Remove that String exp = root.getTextContent();
group.set("Node",exp,""); // <---Remove that //group.set("Node",exp,"");
newsItemList.add(group);// <---Remove that //newsItemList.add(group);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
group.set("Node2","end",""); // <---Remove that
newsItemList.add(group);// <---Remove that callback.onSuccessParsing();
group.set("Node3","2end",""); // <---Remove that
newsItemList.add(group);// <---Remove that
callback.onSuccessParsing(newsItemList);
} }
} }

Loading…
Cancel
Save