Prado\Xml\TXmlDocument::loadFromFile PHP Méthode

loadFromFile() public méthode

Loads and parses an XML document.
public loadFromFile ( $file ) : boolean
Résultat boolean whether the XML file is parsed successfully
    public function loadFromFile($file)
    {
        if (($str = @file_get_contents($file)) !== false) {
            return $this->loadFromString($str);
        } else {
            throw new TIOException('xmldocument_file_read_failed', $file);
        }
    }

Usage Example

Exemple #1
0
 public function testLoadFromFile()
 {
     $file = dirname(__FILE__) . '/data/test.xml';
     $xmldoc = new TXmlDocument();
     try {
         $xmldoc->loadFromFile('unexistentXmlFile.xml');
         self::fail('Expected TIOException not thrown');
     } catch (TIOException $e) {
     }
     self::assertTrue($xmldoc->loadFromFile($file));
     self::assertEquals('1.0', $xmldoc->getVersion());
     self::assertEquals('UTF-8', $xmldoc->getEncoding());
 }
All Usage Examples Of Prado\Xml\TXmlDocument::loadFromFile