Example

Example – Example usage of XML_DTD

Example usage of XML_DTD

You can validate a XML file against a DTD using isValid() like in the example below:

<?php

require_once 'XML/DTD/XmlValidator.php';

$dtd_file realpath('myfile.dtd');
$xml_file realpath('myfile.xml');

$validator = new XML_DTD_XmlValidator();
if (!
$validator->isValid($dtd_file$xml_file)) {
    die(
$validator->getMessage());
}

?>

isValid() will return true when the XML document validates and false otherwise.

This is pretty much the most common usage of XML_DTD and all you need to know to get started.

Introduction to XML_DTD (Previous) XML_Feed_Parser (Next)
Last updated: Sun, 21 Dec 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.