1--TEST-- 2Tests DOMDocument::standalone get, set, and functionality 3--CREDITS-- 4Chris Snyder <chsnyder@gmail.com> 5# TestFest 2009 NYPHP 6--EXTENSIONS-- 7dom 8--FILE-- 9<?php 10// create dom document 11$dom = new DOMDocument; 12$xml = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 13<!DOCTYPE s1 PUBLIC "http://www.ibm.com/example.dtd" "example.dtd"> 14<s1>foo</s1>'; 15$dom->loadXML($xml); 16if(!$dom) { 17 echo "Error while parsing the document\n"; 18 exit; 19} 20echo "Standalone DOMDocument created\n"; 21 22$test = $dom->standalone; 23echo "Read initial standalone:\n"; 24var_dump( $test ); 25 26$dom->standalone = FALSE; 27$test = $dom->standalone; 28echo "Set standalone to FALSE, reading again:\n"; 29var_dump( $test ); 30 31$test = $dom->saveXML(); 32echo "Document is no longer standalone\n"; 33var_dump( $test ); 34 35echo "Done"; 36?> 37--EXPECT-- 38Standalone DOMDocument created 39Read initial standalone: 40bool(true) 41Set standalone to FALSE, reading again: 42bool(false) 43Document is no longer standalone 44string(136) "<?xml version="1.0" encoding="UTF-8" standalone="no"?> 45<!DOCTYPE s1 PUBLIC "http://www.ibm.com/example.dtd" "example.dtd"> 46<s1>foo</s1> 47" 48Done 49