Above one is the XML file. I need to get the value for the Google analytics from the above xml file
I need to get the output as from the above xml. I have tried the following code but it's not showing any output Can you help me on this
Above one is the XML file. I need to get the value for the Google analytics from the above xml file
public class Xml {
public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException, XPathExpressionException {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document document = db.parse(new FileInputStream(new File("C:\\Users\\VAMSIKRISHNA\\Desktop\\Apache Poi\\appConfig.plist")));
NodeList nodeList=document.getElementsByTagName("key");
NodeList nodeList1=document.getElementsByTagName("string");
for (int i=0; i < nodeList.getLength(); i++) {
for(int j=0;j<nodeList1.getLength();j++) {
Node node = nodeList.item(i);
Node node1=nodeList1.item(j);
if (node.getNodeName()=="GA") {
System.out.println("Nodename"+node1.getNodeName()+" : "+node1.getFirstChild().getTextContent().trim());
}
}
}
}
}