Creates a new DOMDocument object with version and encoding in PHP

Description

The following code shows how to creates a new DOMDocument object with version and encoding.

Example


//www  .  jav a2s.  c  o m
<?php

$dom = new DOMDocument('1.0', 'iso-8859-1');

echo $dom->saveXML();
/* <?xml version="1.0" encoding="iso-8859-1"?> */

?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    XML »




DOM
SimpleXML
SimpleXMLElement
XML Parser