I need to parse an XML file and I need also to parse the doctype. I've tried with XML Reader but when I found a nodetype 10 (doctype), I can't get it's value.
There is a way to extract the doctype from an XML file, with XMLReader?
Edit: as asked, some sample code. however is nothing rather than a dump, right now.
$reader = new XMLReader( );
$filename = 'test.xhtml';
$reader->open($filename);
while( $reader->read( ) )
{
$nodeType = $reader->nodeType;
$nodeName = $reader->name;
$nodeValue = $reader->value;
if( $nodeType == 10 )
{
echo $nodeType ."\n";
echo $nodeName ."\n";
echo $nodeValue ."\n";
echo $reader->localName ."\n";
echo $reader->namespaceURI ."\n";
echo $reader->prefix ."\n";
echo $reader->xmlLang ."\n";
echo $reader->readString() . "\n";
echo $reader->readInnerXML() . "\n";
while( $reader->moveToNextAttribute( ) )
{
echo $reader->name . "=" . $reader->value;
}
}