You are here

public function HTML5::parseFragment in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/src/HTML5.php \Masterminds\HTML5::parseFragment()

Parse an input stream where the stream is a fragment.

Lower-level loading function. This requires an input stream instead of a string, file, or resource.

1 call to HTML5::parseFragment()
HTML5::loadHTMLFragment in vendor/masterminds/html5/src/HTML5.php
Parse a HTML fragment from a string.

File

vendor/masterminds/html5/src/HTML5.php, line 185

Class

HTML5
This class offers convenience methods for parsing and serializing HTML5. It is roughly designed to mirror the \DOMDocument class that is provided with most versions of PHP.

Namespace

Masterminds

Code

public function parseFragment(\Masterminds\HTML5\Parser\InputStream $input, array $options = array()) {
  $events = new DOMTreeBuilder(true, array_merge($this
    ->getOptions(), $options));
  $scanner = new Scanner($input);
  $parser = new Tokenizer($scanner, $events);
  $parser
    ->parse();
  $this->errors = $events
    ->getErrors();
  return $events
    ->fragment();
}