1--TEST-- 2DOM Document : save and saveXML 3--CREDITS-- 4Sami Greenbury (sami@patabugen.co.uk) 5# TestFest 2008 6--SKIPIF-- 7<?php 8require_once('skipif.inc'); 9?> 10--FILE-- 11<?php 12 13$xml = <<< EOXML 14<?xml version="1.0" encoding="utf-8"?> 15<courses> 16 <!-- Hello World! --> 17 <aNode> 18 <childNode> 19 <childlessNode /> 20 </childNode> 21 </aNode> 22</courses> 23EOXML; 24 25$dom = new DOMDocument(); 26$dom->loadXML($xml); 27$root = $dom->documentElement; 28$directory = dirname(__FILE__); 29 30$filename = $directory."/tmp_dom_savexml".time(); 31var_dump($dom->save($filename)); 32$result = file_get_contents($filename); 33var_dump($result == $dom->saveXML()); 34 35unlink($filename); 36 37--EXPECTF-- 38int(151) 39bool(true)