src/ministruts/Module.php
protected function loadConfiguration($fileName) {
        if (!is_file($fileName)) throw new StrutsConfigException('Configuration file not found: "'.$fileName.'"');

        // TODO: what about checking the search result?
        $content = file_get_contents($fileName);
        $search  = '<!DOCTYPE struts-config SYSTEM "struts-config.dtd">';
        $offset  = strpos($content, $search);
        $dtd     = str_replace('\\', '/', __DIR__.'/dtd/struts-config.dtd');
        $replace = '<!DOCTYPE struts-config SYSTEM "file:///'.$dtd.'">';
        $content = substr_replace($content, $replace, $offset, strlen($search));

        // Konfiguration parsen und validieren
        return new \SimpleXMLElement($content, LIBXML_DTDVALID|LIBXML_NONET);
    }
protected function loadConfiguration($fileName) {
        if (!is_file($fileName)) throw new StrutsConfigException('Configuration file not found: "'.$fileName.'"');

        // TODO: what about checking the search result?
        $content = file_get_contents($fileName);
        $search  = '<!DOCTYPE struts-config SYSTEM "struts-config.dtd">';
        $offset  = strpos($content, $search);
        $dtd     = str_replace('\\', '/', __DIR__.'/dtd/struts-config.dtd');
        $replace = '<!DOCTYPE struts-config SYSTEM "file:///'.$dtd.'">';
        $content = substr_replace($content, $replace, $offset, strlen($search));

        // Konfiguration parsen und validieren
        return new \SimpleXMLElement($content, LIBXML_DTDVALID|LIBXML_NONET);
    }
protected function loadConfiguration ( $ fileName ) { if ( ! is_file ( $ fileName ) ) throw new StrutsConfigException ( 'Configuration file not found: "' . $ fileName . '"' ) ; // TODO: what about checking the search result? $ content = file_get_contents ( $ fileName ) ; $ search = '<!DOCTYPE struts-config SYSTEM "struts-config.dtd">' ; $ offset = strpos ( $ content , $ search ) ; $ dtd = str_replace ( '\\' , '/' , __DIR__ . '/dtd/struts-config.dtd' ) ; $ replace = '<!DOCTYPE struts-config SYSTEM "file:///' . $ dtd . '">' ; $ content = substr_replace ( $ content , $ replace , $ offset , strlen ( $ search ) ) ; // Konfiguration parsen und validieren return new \ SimpleXMLElement ( $ content , LIBXML_DTDVALID | LIBXML_NONET ) ; }
Validiert die angegebene Konfigurationsdatei und wandelt sie in ein XML-Objekt um.

@param  string $fileName - Pfad zur Konfigurationsdatei

@return \SimpleXMLElement

@throws StrutsConfigException on configuration errors
Validiert die angegebene Konfigurationsdatei und wandelt sie in ein XML - Objekt um .