XMLReader::isValid

(PHP 5 >= 5.1.0, PHP 7)

XMLReader::isValidIndicates if the parsed document is valid

说锟斤拷

public XMLReader::isValid ( void ) : bool

Returns a boolean indicating if the document being parsed is currently valid.

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 TRUE锟斤拷 锟斤拷锟斤拷锟斤拷失锟斤拷时锟斤拷锟斤拷 FALSE锟斤拷

锟斤拷锟斤拷

Example #1 Validating XML

<?php
$xml 
XMLReader::open('test.xml');

// The validate parser option must be enabled for 
// this method to work properly
$xml->setParserProperty(XMLReader::VALIDATEtrue);

var_dump($xml->isValid());
?>

注锟斤拷

Note: This checks the current node, not the entire document.

锟轿硷拷