FluentDOM::load PHP Method

load() public static method

Load a data source into a FluentDOM\Document
public static load ( mixed $source, string $contentType = 'text/xml', array $options = [] ) : Document
$source mixed
$contentType string
$options array
return FluentDOM\Document
    public static function load($source, $contentType = 'text/xml', array $options = [])
    {
        if (!isset(self::$_loader)) {
            self::$_loader = self::getDefaultLoaders();
        }
        $result = self::$_loader->load($source, $contentType, $options);
        return $result instanceof \DOMDocument ? $result : $result->getDocument();
    }

Usage Example

Example #1
0
/**
* Function to create a new FluentDOM instance and loads data into it if
* a valid $source is provided.
*
* @param mixed $source
* @param string $contentType optional, default value 'text/xml'
* @return FluentDOM
*/
function FluentDOM($source = NULL, $contentType = 'text/xml')
{
    $result = new FluentDOM();
    if (isset($source)) {
        return $result->load($source, $contentType);
    } else {
        return $result;
    }
}
All Usage Examples Of FluentDOM::load