Sample code for 30+ languages & platforms
Java

Decode HTML Entities found in XML

Demonstrates how to decode HTML entities found in XML.

Chilkat Java Downloads

Chilkat2 Java
import com.chilkatsoft.chilkat2.Xml;

public class ChilkatExample {

    public static void main(String[] args) {
        // Load an XML file containing the following:

        // <?xml version="1.0" encoding="UTF-8"?>
        // <output>Franz&#xf6;sische</output>

        Xml xml = new Xml();
        xml.loadXmlFile("qa_data/xml/hasHtmlEntity.xml");

        // Get non-decoded content, then get decoded content.

        // Result is Franz&#xf6;sische
        System.out.println(xml.getContent());

        // Result is Französische
        String strDecoded = xml.decodeEntities(xml.getContent());
        System.out.println(strDecoded);
    }
}