@@ -0,0 +1,2152 @@
+package main.java;%0A%0Aimport java.io.File;%0Aimport java.io.IOException;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport javax.xml.parsers.DocumentBuilder;%0Aimport javax.xml.parsers.DocumentBuilderFactory;%0Aimport javax.xml.parsers.ParserConfigurationException;%0A%0Aimport org.w3c.dom.Document;%0Aimport org.w3c.dom.Element;%0Aimport org.w3c.dom.Node;%0Aimport org.w3c.dom.NodeList;%0Aimport org.xml.sax.SAXException;%0A%0Apublic class DomParserExample %7B%0A%09public static void main(String%5B%5D args) throws ParserConfigurationException,%0A%09%09%09SAXException, IOException %7B%0A%09    %0A%09%09//if(args.length != 1)%0A%09%09%09//throw new RuntimeException(%22The name of the XML file is required!%22);%0A%09%09%0A%0A%09%09DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();%0A%09%09DocumentBuilder builder = factory.newDocumentBuilder();%0A%09%09//File employeeFile = new File(%22Employees.xml%22);%0A%09%09File SMSFile = new File(%22smsCorpusAnonymized-1.1.xml%22); %0A%09%09%0A%09%09//Document document = builder.parse(employeeFile);%0A%09%09Document document = builder.parse(SMSFile); %0A%09%09%0A%0A%09%09//List%3CEmployee%3E employees = new ArrayList%3CEmployee%3E();%0A%09%09List%3CSMS%3E sms = new ArrayList%3CSMS%3E(); %0A%0A%09%09%0A%09%09NodeList nodeList = document.getDocumentElement().getChildNodes();%0A%09%09for (int i = 0; i %3C nodeList.getLength(); i++) %7B%0A%0A%09%09%09Node node = nodeList.item(i);%0A%0A%09%09%09if (node.getNodeType() == Node.ELEMENT_NODE) %7B%0A%09%09%09%09Element elem = (Element) node;%0A%09%09%09%09     %0A%09%09%09%09%0A%09%09%09%09String id = elem.getAttribute(%22id%22); %0A%09%09%09%09String text =elem.getElementsByTagName(%22text%22).item(0).getChildNodes().item(0).getNodeValue(); %0A%09%09%09%09String country = elem.getElementsByTagName(%22source%22).item(0).getAttributes().item(0).getNodeValue(); %0A%09%09%09%09String srcID = elem.getElementsByTagName(%22srcID%22).item(0).getChildNodes().item(0).getNodeValue(); %0A%09%09%09%09String collector = elem.getElementsByTagName(%22collectionMethod%22).item(0).getAttributes().item(0).getNodeValue();%0A%09%09%09%09String year = elem.getElementsByTagName(%22collectionMethod%22).item(0).getAttributes().getNamedItem(%22year%22).getNodeValue(); %0A%09%09%09%09%0A%09%09%09%09%0A%0A%09%09%09%09sms.add(new SMS (id,text,  country,  srcID,  collector,  year)); %0A%09%09%09%09 %0A%09%09%09%7D%0A%09%09%7D%0A%09%09// Print all employees.%0A%09%09for (SMS text : sms)%0A%09%09%09System.out.println(text.toString());%0A%09%7D%0A%7D%0A

Create DomParser.java