array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'xmlreader.isvalid.php', 1 => 'XMLReader::isValid', 2 => 'Indicates if the parsed document is valid', ), 'up' => array ( 0 => 'class.xmlreader.php', 1 => 'XMLReader', ), 'prev' => array ( 0 => 'xmlreader.getparserproperty.php', 1 => 'XMLReader::getParserProperty', ), 'next' => array ( 0 => 'xmlreader.lookupnamespace.php', 1 => 'XMLReader::lookupNamespace', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/xmlreader/xmlreader/isvalid.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
XMLReader::isValid — Indicates if the parsed document is valid
Returns a boolean indicating if the document being parsed is currently valid according to the DTD, or an XML or RelaxNG schema.
If there is no schema, and the DTD validation option is not provided, this method will return false
.
У цієї функції немає параметрів.
Приклад #1 Validating XML
<?php
$xml = XMLReader::open('examples/book-simple.xml');
// The validate parser option must be enabled for
// this method to work properly
$xml->setParserProperty(XMLReader::VALIDATE, true);
var_dump($xml->isValid());
?>
Зауваження: This checks the current node, not the entire document.