cvs: pear /XML_DTD/tests test.php
| From: | Thomas V.V.Cox | Date: | Sun, 24 Feb 2002 04:39:41 +0000 |
| Subject: | cvs: pear /XML_DTD/tests test.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-2584@lists.php.net to get a copy of this message | ||
cox Sat Feb 23 23:39:41 2002 EDT
Modified files:
/pear/XML_DTD/tests test.php
Log:
test.php file.dtd (prints the DTD tree)
test.php file.dtd file.xml (validates file.xml against file.dtd)
Index: pear/XML_DTD/tests/test.php
diff -u pear/XML_DTD/tests/test.php:1.1 pear/XML_DTD/tests/test.php:1.2
--- pear/XML_DTD/tests/test.php:1.1 Sat Feb 23 16:15:02 2002
+++ pear/XML_DTD/tests/test.php Sat Feb 23 23:39:41 2002
@@ -1,10 +1,16 @@
#!/usr/bin/php -Cq
<?php
-require 'XML/DTD_Validator.php';
-$dtd = './package.dtd';
-$xml = $argv[1];
-$a = new DTD_Validator;
-if (!$a->isValid($dtd, $xml)) {
- echo $a->getError();
+$dtd = $argv[1];
+$xml = isset($argv[2]) ? $argv[2] : false;
+if (!$xml) {
+ include 'XML/DTD_Parser.php';
+ $a = new XML_DTD_Parser;
+ print_r($a->parse($dtd));
+} else {
+ include 'XML/DTD_Validator.php';
+ $a = new XML_DTD_Validator;
+ if (!$a->isValid($dtd, $xml)) {
+ echo $a->getMessage();
+ }
}
?>