<commit_before>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();
    }
}
<commit_msg>fix Xml ant compile error<commit_after>package com.pivotallabs.api;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
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 element, String childTagName) {
        return getText(element.getElementsByTagName(childTagName));
    }

    public static String getTextContentOfChild(Document document, String childTagName) {
        return getText(document.getElementsByTagName(childTagName));
    }

    private static String getText(NodeList nodeList) {
        return nodeList.item(0).getFirstChild().getNodeValue();
    }
}

{'fraction_non_alphanumeric': 0.08731652239367708, 'fraction_numerical': 0.0030109145652992097, 'mean_word_length': 4.765726681127982, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 10}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7043628', 'n_tokens_mistral': 716, 'n_tokens_neox': 702, 'n_words': 153}