XmlUtils { public Node getSingleNode(String xp) { return getSingleNode(xp, currentDoc); } XmlUtils();  XmlUtils(EntityResolver er); @Deprecated  XmlUtils(NamespaceContext ctx);  XmlUtils(NamespaceContext ctx, DocumentBuilderFactory f); @Deprecated  XmlUtils(EntityResolver er, URIResolver ur); @Deprecated  XmlUtils(EntityResolver er, URIResolver ur, NamespaceContext ctx); @Deprecated  XmlUtils(EntityResolver er, URIResolver ur, NamespaceContext ctx, DocumentBuilderFactory dbf);  XmlUtils(EntityResolver er, NamespaceContext ctx, DocumentBuilderFactory dbf); void setSchema(String uri); void setSource(InputSource xml); void setSource(Reader xml); void setSource(InputStream xml); void setSource(Node node); String getSingleTextItem(String xp, Node documentNode); String getSingleTextItem(String xp); String[] getMultipleTextItems(String xp, Node documentNode); String[] getMultipleTextItems(String xp); org.w3c.dom.NodeList getNodeList(String xp, Node documentNode); org.w3c.dom.NodeList getNodeList(String xp); Node getSingleNode(String xp); Node getSingleNode(String xp, Node n); void reset(); boolean isDocumentValid(); String getParseMessage(); Node createNode(String xp); void setNodeValue(String xp, String value); void setNodeValue(String xp, String v, Node root); void setNodeValue(String value, Node n); void setAttribute(String xp, String name, String value); void setAttribute(String name, String value, Node n); void deleteAttribute(String name, Node n); void insertNodeBefore(Node newNode, Node existingNode, Node parent); void appendNode(Node newNode, Node parent); void removeNode(Node toBeRemoved, Node parent); void writeDocument(OutputStream output); void writeDocument(Writer output); void writeDocument(OutputStream output, String encoding); void writeDocument(Writer output, String encoding); void writeDocument(Node node, OutputStream output); void writeDocument(Node node, Writer writer); void writeDocument(Node node, OutputStream output, String encoding); void writeDocument(Node node, Writer writer, String encoding); Document getCurrentDoc(); T castOrFail(Object o, Class<T> type, String exceptionMsg);  }
@Test public void testGetSingleNode() throws Exception { XmlUtils xu = new XmlUtils(); xu.setSource(new StringReader(multiLine)); assertNull(xu.getSingleNode("/root/lame")); Node n = xu.getSingleNode("/root/test"); assertNotNull(n); assertNull(xu.getSingleNode("/root/test", null)); }