generator/src/DocPage.php
public function loadAndResolveFile(): \SimpleXMLElement
    {
        $content = \file_get_contents($this->path);
        $strpos = \strpos($content, '?>')+2;
        if (!\file_exists(__DIR__.'/../doc/entities/generated.ent')) {
            self::buildEntities();
        }
        $path = \realpath(__DIR__.'/../doc/entities/generated.ent');


        $content = \substr($content, 0, $strpos)
            .'<!DOCTYPE refentry SYSTEM "'.$path.'">'
            .\substr($content, $strpos+1);

        echo 'Loading '.$this->path."\n";
        $elem = \simplexml_load_string($content, \SimpleXMLElement::class, LIBXML_DTDLOAD | LIBXML_NOENT);
        if ($elem === false) {
            throw new \RuntimeException('Invalid XML file for '.$this->path);
        }
        $elem->registerXPathNamespace('docbook', 'http://docbook.org/ns/docbook');

        return $elem;
    }
public function loadAndResolveFile(): \SimpleXMLElement
    {
        $content = \file_get_contents($this->path);
        $strpos = \strpos($content, '?>')+2;
        if (!\file_exists(__DIR__.'/../doc/entities/generated.ent')) {
            self::buildEntities();
        }
        $path = \realpath(__DIR__.'/../doc/entities/generated.ent');


        $content = \substr($content, 0, $strpos)
            .'<!DOCTYPE refentry SYSTEM "'.$path.'">'
            .\substr($content, $strpos+1);

        echo 'Loading '.$this->path."\n";
        $elem = \simplexml_load_string($content, \SimpleXMLElement::class, LIBXML_DTDLOAD | LIBXML_NOENT);
        if ($elem === false) {
            throw new \RuntimeException('Invalid XML file for '.$this->path);
        }
        $elem->registerXPathNamespace('docbook', 'http://docbook.org/ns/docbook');

        return $elem;
    }
public function loadAndResolveFile ( ) : \ SimpleXMLElement { $ content = \ file_get_contents ( $ this -> path ) ; $ strpos = \ strpos ( $ content , '?>' ) + 2 ; if ( ! \ file_exists ( __DIR__ . '/../doc/entities/generated.ent' ) ) { self :: buildEntities ( ) ; } $ path = \ realpath ( __DIR__ . '/../doc/entities/generated.ent' ) ; $ content = \ substr ( $ content , 0 , $ strpos ) . '<!DOCTYPE refentry SYSTEM "' . $ path . '">' . \ substr ( $ content , $ strpos + 1 ) ; echo 'Loading ' . $ this -> path . "\n" ; $ elem = \ simplexml_load_string ( $ content , \ SimpleXMLElement :: class , LIBXML_DTDLOAD | LIBXML_NOENT ) ; if ( $ elem === false ) { throw new \ RuntimeException ( 'Invalid XML file for ' . $ this -> path ) ; } $ elem -> registerXPathNamespace ( 'docbook' , 'http://docbook.org/ns/docbook' ) ; return $ elem ; }
Loads the XML file, resolving all DTD declared entities.

@return \SimpleXMLElement
Loads the XML file resolving all DTD declared entities .