1--TEST-- 2DOMDocument::$validateOnParse - effectual determination (dom_document_validate_on_parse_read/dom_document_validate_on_parse_write) 3--CREDITS-- 4Hans Zaunere 5# TestFest 2009 NYPHP 6--EXTENSIONS-- 7dom 8--FILE-- 9<?php 10 11require_once('dom_test.inc'); 12 13chdir(__DIR__); 14$XMLStringGood = file_get_contents(__DIR__.'/note.xml'); 15 16$dom = new DOMDocument; 17$dom->resolveExternals = TRUE; 18 19$dom->validateOnParse = FALSE; 20echo "validateOnParse set to FALSE: \n"; 21$dom->loadXML($XMLStringGood); 22echo "No Error Report Above\n"; 23 24$BogusElement = $dom->createElement('NYPHP','DOMinatrix'); 25$Body = $dom->getElementsByTagName('from')->item(0); 26$Body->appendChild($BogusElement); 27$XMLStringBad = $dom->saveXML(); 28 29echo "validateOnParse set to TRUE: \n"; 30$dom->validateOnParse = TRUE; 31$dom->loadXML($XMLStringBad); 32echo "Error Report Above\n"; 33 34?> 35--EXPECTF-- 36validateOnParse set to FALSE: 37No Error Report Above 38validateOnParse set to TRUE: 39 40Warning: DOMDocument::loadXML(): No declaration for element NYPHP in Entity, line: %d in %s on line %d 41 42Warning: DOMDocument::loadXML(): Element from was declared #PCDATA but contains non text nodes in Entity, line: %d in %s on line %d 43Error Report Above 44