Sample code for 30+ languages & platforms
C

Decode HTML Entities found in XML

Demonstrates how to decode HTML entities found in XML.

Chilkat C Downloads

C
#include <C_CkXml.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkXml xml;
    const char *strDecoded;

    success = FALSE;

    //  Load an XML file containing the following:

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

    xml = CkXml_Create();
    success = CkXml_LoadXmlFile(xml,"qa_data/xml/hasHtmlEntity.xml");

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

    //  Result is Franz&#xf6;sische
    printf("%s\n",CkXml_content(xml));

    //  Result is Französische
    strDecoded = CkXml_decodeEntities(xml,CkXml_content(xml));
    printf("%s\n",strDecoded);


    CkXml_Dispose(xml);

    }