On 2.8.2005 10:16 Uhr, Ron Korving wrote:
Shouldn't PHP suppress this warning then? Right now 3 warnings are shown for
just one bad statement. I think one warning would suffice. Of course this is
all rather unimportant and very low-priority, but I still think it's a
situation that could be improved.
You can see the warnings at http://bugs.php.net/bug.php?id=33951
AFAICS these are all libxml2 warnings. We would have to start
intercepting those warnings and decide which one we want to show and
which not... Too much hassle IMHO. In your scenario, which should be shown?
And with the new libxml error handler code in PHP 5.1, the developer can
decide, what he wants to show and what not... See
http://www.php.net/libxml_use_internal_errors
and
http://php5.bitflux.org/xml5_1/slide_13.php
for some explenation and examples
The most interesting example is at
http://php.net/libxml_get_errors
But while I was reading again the example I wrote, I found that libxml always returns column 0:
<?php
libxml_use_internal_errors(true);
$xmlstr = <<< XML
<?xml version='1.0' standalone='yes'?>
<movies > <movie> <titles>PHP: Behind the Parser</title> </mdovie></movies>
XML;
$doc = simplexml_load_string($xmlstr);
$xml = explode("\n", $xmlstr);
print_r(libxml_get_errors());
?>
Array
(
[0] => LibXMLError Object
(
[level] => 3
[code] => 76
[column] => 0
[message] => Opening and ending tag mismatch: titles line 2 and title
[file] =>
[line] => 2
)
[1] => LibXMLError Object
(
[level] => 3
[code] => 76
[column] => 0
[message] => Opening and ending tag mismatch: movie line 2 and mdovie
[file] =>
[line] => 2
)
)
This seems to be a bug to me, or the column stuff will only work when validating with a dtd/..?
Nuno