FluentDOM\Loader\Xml::load PHP Method

load() public method

See also: Loadable::load
public load ( string $source, string $contentType, array | Traversable | Options $options = [] ) : Document | Result | null
$source string
$contentType string
$options array | Traversable | Options
return FluentDOM\Document | Result | null
    public function load($source, $contentType, $options = [])
    {
        if ($this->supports($contentType)) {
            $dom = new Document();
            $dom->preserveWhiteSpace = FALSE;
            $loadOptions = isset($options[self::LIBXML_OPTIONS]) ? (int) $options[self::LIBXML_OPTIONS] : 0;
            if ($this->startsWith($source, '<')) {
                $dom->loadXml($source, $loadOptions);
            } else {
                $dom->load($source, $loadOptions);
            }
            return $dom;
        }
        return NULL;
    }