Skip to content Skip to sidebar Skip to footer

Is There A Way To Extract Text Verbatim In Between Html Tags In Dom?

For example, for an HTML document:

Hello world

I know I can use getTextContent() to g

Solution 1:

In Java, you can apply a XSLT transformation: https://docs.oracle.com/javase/tutorial/jaxp/xslt/writingDom.html

What you need is to retrieve the XML content of the element subtree. There are several questions in SO addressing this issue: How to I output org.w3c.dom.Element to string format in java?

Java/DOM: Get the XML content of a node

Get a node's inner XML as String in Java DOM

Post a Comment for "Is There A Way To Extract Text Verbatim In Between Html Tags In Dom?"