Speed up development with full-stack environments for every branch.

Learn More

Check if a xml document is valid [XMLReader and PHP]

1262 Runs 4786 Views 2394 Copies


gtsolutions 373

published 4 years ago

 * PHP XMLReader - Check if a xml document is valid

$reader = new XMLReader();

// Set parser options - you must set this in order to use isValid method
$reader->setParserProperty(XMLReader::VALIDATE, true);

if ($reader->isValid())
    echo "The XML is valid";
    echo "The XML is NOT valid";
Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).