Java tutorial
//package com.java2s; import org.w3c.dom.Node; public class Main { /** * Extracts a Boolean from a result that consists of a Boolean only. * * @param result * @return the Boolean */ public static boolean extractBoolean(Node result) { if (result == null) { return false; } return 1 == extractInt(result); } /** * Extracts an Integer from a document that consists of an Integer only. * * @param doc * @return the Integer */ public static int extractInt(Node doc) { if (doc == null) { return 0; } return Integer.parseInt(doc.getFirstChild().getTextContent()); } }