--TEST--
XMLReader: accessing empty and non existing attributes
--EXTENSIONS--
xmlreader
--FILE--
EOF;
$reader = new XMLReader();
$reader->XML($xmlstring);
$reader->read();
var_dump($reader->getAttribute('bar'));
var_dump($reader->getAttribute('baz'));
$reader->close();
$xmlstring =<<
EOF;
$xmlstring = str_replace('012.dtd', __DIR__.'/012.dtd', $xmlstring);
if (DIRECTORY_SEPARATOR == '\\') {
$xmlstring = str_replace('\\',"/", $xmlstring);
}
$reader = new XMLReader();
$reader->XML($xmlstring);
$reader->setParserProperty(XMLReader::DEFAULTATTRS, true);
while($reader->read() && $reader->nodeType != XMLReader::ELEMENT);
var_dump($reader->getAttribute('bar'));
var_dump($reader->getAttribute('baz'));
$reader->close();
echo "\nUsing URI:\n";
$reader = new XMLReader();
$file = __DIR__ . '/012.xml';
if (DIRECTORY_SEPARATOR == '\\') {
$file = str_replace('\\',"/", $file);
}
$reader->open($file);
//$reader->setParserProperty(XMLReader::DEFAULTATTRS, true);
while($reader->read() && $reader->nodeType != XMLReader::ELEMENT);
var_dump($reader->getAttribute('bar'));
var_dump($reader->getAttribute('baz'));
$reader->close();
$reader = new XMLReader();
$reader->open(__DIR__ . '/012.xml');
$reader->setParserProperty(XMLReader::DEFAULTATTRS, true);
while($reader->read() && $reader->nodeType != XMLReader::ELEMENT);
var_dump($reader->getAttribute('bar'));
var_dump($reader->getAttribute('baz'));
$reader->close();
?>
--EXPECT--
string(0) ""
NULL
string(0) ""
string(0) ""
Using URI:
string(0) ""
NULL
string(0) ""
string(0) ""