Node xmlNode = // get the XML node String id = xmlNode.getAttributes().getNamedItem("id").getNodeValue();
Node htmlNode = // get the HTML node String textContent = htmlNode.getTextContent();In this example, we use the getTextContent() method to retrieve the text content of the HTML element. Package library: org.w3c.dom Overall, Node.get() is a useful method to have in your toolkit when working with XML and HTML documents in Java.