Code example for Element

Methods: getTextContent

0
        if (nl != null && nl.getLength() > 0) {
 
            // only reads the first element 
            Element el = (Element) nl.item(0);
 
            String maxMemoryPerInstance = el.getTextContent();
            if (maxMemoryPerInstance != null) {
                return Long.parseLong(maxMemoryPerInstance);
            } 
 
            String msg =
                "maxMemoryPerInstance's value is null in " + INSTANCE_CONFIG_XML_FILE + ".";
            log.error(msg);
            throw new Exception(msg);
        } 
 
        String msg =
            "maxMemoryPerInstance element cannot be found at " + INSTANCE_CONFIG_XML_FILE + " .";
        log.error(msg);
        throw new Exception(msg);