package com.pivotallabs.api;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

public class Xmls {

    public static Document getDocument(String xmlString) throws SAXException, IOException, ParserConfigurationException {
        InputStream inputStream = new ByteArrayInputStream(xmlString.getBytes());
        Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
        document.normalize();
        return document;
    }

    public static Element getElement(Document document, String tagName, int index) {
        return (Element) document.getElementsByTagName(tagName).item(index);
    }

    public static String getTextContentOfChild(Element item, String childTagName) {
        return item.getElementsByTagName(childTagName).item(0).getTextContent();
    }

    public static String getTextContentOfChild(Document item, String childTagName) {
        return item.getElementsByTagName(childTagName).item(0).getTextContent();
    }
}

@@ -76,24 +76,53 @@
 om.Element;%0A
+import org.w3c.dom.NodeList;%0A
 import org.x
@@ -954,28 +954,31 @@
 ild(Element 
-item
+element
 , String chi
@@ -997,36 +997,47 @@
 %0A        return 
-item
+getText(element
 .getElementsByTa
@@ -1059,32 +1059,8 @@
 ame)
-.item(0).getTextContent(
 );%0A 
@@ -1121,20 +1121,24 @@
 ocument 
-item
+document
 , String
@@ -1169,20 +1169,32 @@
  return 
-item
+getText(document
 .getElem
@@ -1224,31 +1224,133 @@
 ame)
-.item(0).getTextContent
+);%0A    %7D%0A%0A    private static String getText(NodeList nodeList) %7B%0A        return nodeList.item(0).getFirstChild().getNodeValue
 ();%0A

fix Xml ant compile error