Validating XML Issue
| From: | Alice Wei | Date: | Thu, 03 Sep 2009 14:26:21 +0000 |
| Subject: | Validating XML Issue | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-297633@lists.php.net to get a copy of this message | ||
Hi,
This seems like a small problem that I have read from http://us.php.net/manual/en/xmlreader.isvalid.php.
I have the code snippet here as follows:
<?php
$xml = XMLReader::open('hello.xml');
// You must to use it
$xml->setParserProperty(XMLReader::VALIDATE, true);
if ($xml->isValid()) echo "true";
else echo "NOT";
?>
Here is the contents of hello.xml:
<greeting><hello>Hello</hello>
Obviously, this is not a well formed XML file.
However, whenever I run the PHP code, it returns true, how do I get it to validate it the way it is
supposed to be?
Thanks for your help.
Alice
_________________________________________________________________
Search from any Web page with powerful protection. Get the FREE Windows Live Toolbar Today!
http://get.live.com/toolbar/overview