javaxmlescapingdeprecatedstringescapeutils

How to unescape xml in java?


Unfortunately all about this topic is too old, so i need a help.

How i can unescape xml in java? I tried StringEscapeUtils.unescapeXml from import org.apache.commons.lang3.StringEscapeUtils; but it's deprecated. I also tried StringEscapeUtils as an object but there is only escapeHtml14 Next I tried answer from this Why was org.apache.common.lang3 StringEscapeUtils deprecated? adding to maven, but it didn't work too.

Also tried enter image description here

with adding

<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-text -->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-text</artifactId>
    <version>1.10.0</version>
</dependency>

to maven.

Can somebody help me please?


Solution

  • Try commons text StringEscapeUtils it should work fine

    import org.apache.commons.text.StringEscapeUtils have StringEscapeUtils.unescapeXml();

    This is a build issue it is working in my system, I cross-checked in apache commons text javadoc

    enter image description here

    Please clean install using maven and check.