(Java) Decode HTML Entities found in XML
Demonstrates how to decode HTML entities found in XML.
import com.chilkatsoft.*;
public class ChilkatExample {
static {
try {
System.loadLibrary("chilkat");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load.\n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
// Load an XML file containing the following:
// <?xml version="1.0" encoding="UTF-8"?>
// <output>Französische</output>
CkXml xml = new CkXml();
boolean success = xml.LoadXmlFile("qa_data/xml/hasHtmlEntity.xml");
// Get non-decoded content, then get decoded content.
// Result is Französische
System.out.println(xml.content());
// Result is Französische
String strDecoded = xml.decodeEntities(xml.content());
System.out.println(strDecoded);
}
}
|