Sample code for 30+ languages & platforms
PHP

Decode HTML Entities found in XML

Demonstrates how to decode HTML entities found in XML.

Chilkat PHP Downloads

Chilkat2 PHP
<?php

use Chilkat2\Xml;

// Load an XML file containing the following:

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

$xml = new Xml();
$xml->LoadXmlFile('qa_data/xml/hasHtmlEntity.xml');

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

// Result is Franz&#xf6;sische
echo $xml->Content, "\n";

// Result is Französische
$strDecoded = $xml->DecodeEntities($xml->Content);
echo $strDecoded, "\n";