Creates a new DOMEntityReference object in PHP

Description

The following code shows how to creates a new DOMEntityReference object.

Example


/*w  w  w  .  j a  va2 s  .  c  o m*/
<?php

$dom = new DOMDocument('1.0', 'iso-8859-1');
$element = $dom->appendChild(new DOMElement('root'));
$entity = $element->appendChild(new DOMEntityReference('nbsp'));
echo $dom->saveXML(); 

?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    XML »




DOM
SimpleXML
SimpleXMLElement
XML Parser