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