Code example for Element

Methods: getTextContent

0
        } 
        if (tiapp.getGuid().equals("")) {
            NodeList nl = doc.getDocumentElement().getElementsByTagName("guid");
            if (nl != null && nl.getLength() > 0) {
                Element guidElem = (Element) nl.item(0);
                tiapp.setGuid(guidElem.getTextContent());
            } 
        } 
 
        NodeList nl = doc.getDocumentElement().getElementsByTagName("id");
        if (nl != null && nl.getLength() > 0) {
            Element idElem = (Element) nl.item(0);
            tiapp.setProjectId(idElem.getTextContent());
        } 
        return tiapp;
    } 
 
    private String getFromXPath(Document doc, XPath xpath, String query) throws XPathExpressionException {
        return (String) xpath.evaluate(query, doc, XPathConstants.STRING);
    }