note 80564 added to function.xmlreader-isvalid
| From: | anzenews at volja dot net | Date: | Tue, 22 Jan 2008 18:50:35 +0000 |
| Subject: | note 80564 added to function.xmlreader-isvalid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135313@lists.php.net to get a copy of this message | ||
This comment is only partially correct:
"isValid() always returns false unless you enable checking for validity by
$reader->setParserProperty(XMLReader::VALIDATE, true);"
This enables DTD checking, but you can also check by using RelaxNG (see setRelaxNGSchema() and
setRelaxNGSchemaSource()).
And also, this is NOT correct:
"If you just need to check if XML file is well formed, successful loading into XMLReader object
is usually enough."
It is not enough. Pull parsers operate on stream and if you have a large enough file they will not
know it is well formed until it is read to the end. If you need to know if it is well formed or/and
valid, read it till the end or validation error (you can use next() for fast reading if you
don't care about contents).
----
Server IP: 91.185.195.14
Probable Submitter: 193.77.246.99
----
Manual Page -- http://www.php.net/manual/en/function.xmlreader-isvalid.php
Edit -- https://master.php.net/note/edit/80564
Del: integrated -- https://master.php.net/note/delete/80564/integrated
Del: useless -- https://master.php.net/note/delete/80564/useless
Del: bad code -- https://master.php.net/note/delete/80564/bad+code
Del: spam -- https://master.php.net/note/delete/80564/spam
Del: non-english -- https://master.php.net/note/delete/80564/non-english
Del: in docs -- https://master.php.net/note/delete/80564/in+docs
Del: other reasons-- https://master.php.net/note/delete/80564
Reject -- https://master.php.net/note/reject/80564
Search -- https://master.php.net/manage/user-notes.php