XMLReader::isValid

(PHP 5 >= 5.1.0, PHP 7)
Indicates if the parsed document is valid
public bool XMLReader::isValid ( void )

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

Returns:

Returns TRUE on success or FALSE on failure.

Notes:
This checks the current node, not the entire document.
Examples:
Validating XML
<?php
$xml = XMLReader::open('test.xml');

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

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

See also:

XMLReader::setParserProperty() -

XMLReader::setRelaxNGSchema() -

XMLReader::setRelaxNGSchemaSource() -

XMLReader::setSchema() -

doc_php
2016-02-24 16:15:25
Comments
Leave a Comment

Please login to continue.