1--TEST-- 2DOMDocument::relaxNGValidateSource() should fail if document doesn't validate 3--CREDITS-- 4Knut Urdalen <knut@php.net> 5--SKIPIF-- 6<?php 7require_once('skipif.inc'); 8?> 9--FILE-- 10<?php 11$rng = <<< RNG 12<?xml version="1.0" encoding="UTF-8"?> 13<grammar ns="" xmlns="http://relaxng.org/ns/structure/1.0" 14 datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes"> 15 <start> 16 <element name="apple"> 17 <element name="pear"> 18 <data type="NCName"/> 19 </element> 20 </element> 21 </start> 22</grammar> 23RNG; 24 25$bad_xml = <<< BAD_XML 26<?xml version="1.0"?> 27<apple> 28 <pear>Pear</pear> 29 <pear>Pear</pear> 30</apple> 31BAD_XML; 32 33$doc = new DOMDocument(); 34$doc->loadXML($bad_xml); 35$result = $doc->relaxNGValidateSource($rng); 36var_dump($result); 37 38?> 39--EXPECTF-- 40Warning: DOMDocument::relaxNGValidateSource(): Did not expect element pear there in %s on line %d 41bool(false) 42