Creates new document from markup.
Chainable.

@param  unknown_type $markup
@return phpQueryObject|QueryTemplatesSource|QueryTemplatesParse|QueryTemplatesSourceQuery
5983
public static function newDocumentXML($markup = null, $charset = null) 
    {
        $contentType = $charset
        ? ";charset=$charset"
        : '';
        return self::newDocument($markup, "text/xml{$contentType}");
    }
413714
public static function create()
    {
        $ob = new stdClass;
        $ob->value = self::DEFAULT_CONTENT_TYPE;

        return new self(null, $ob);
    }
54900
protected function createDomDocument($html): \DOMDocument
    {
        $document = new \DOMDocument('1.0');
        $previousValue = libxml_use_internal_errors(true);
        libxml_clear_errors();
        $document->loadHTML($html);
        /** @var \LibXMLError[] $errors */
        $errors = libxml_get_errors();
        libxml_clear_errors();
        libxml_use_internal_errors($previousValue);

        foreach ($errors as $error) {
            if (LIBXML_ERR_ERROR === $error->level || LIBXML_ERR_FATAL === $error->level) {
                throw new SourceException(
                    sprintf('%s at %d:%d', trim($error->message), $error->line, $error->column),
                    $error->code
                );
            }
        }

        return $document;
    }
223234
public function build(): GetFlattenedDocumentRequest
	{
		$instance = new GetFlattenedDocumentRequest();
		$instance->depth = $this->depth;
		$instance->pierce = $this->pierce;
		return $instance;
	}
623118
public function create()
	{
		$out	= $this->template;																	//  local copy of set template
		$out	= $this->loadNestedTemplates( $out );												//  search for nested templates and load them
		
		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'pre' )
				$out	= $plugin->work( $out );

 		$out	= preg_replace( '/<%--.*--%>/sU', '', $out );										//  remove template engine style comments
 		if( self::$removeComments )																	//  HTML comments should be removed
			$out	= preg_replace( '/<!--.+-->/sU', '', $out );									//  find and remove all HTML comments 
 		if( self::$removeOptional )																	//  optional parts should be removed
			$out	= preg_replace( '/<%\?--.+--%>/sU', '', $out );									//  find and remove optional parts
		else																						//  otherwise
			$out	= preg_replace( '/<%\?--(.+)--%>/sU', '\\1', $out );							//  find, remove markup but keep content

		foreach( $this->elements as $label => $element )											//  iterate over all registered element containers
		{
			$tmp = '';																				//  
			if( is_object( $element ) )																//  element is an object
			{
				if( !( $element instanceof $this->className ) )										//  object is not an template of this template engine
					continue;																		//  skip this one
				$element = $element->create();														//  render template before concat
			}
			$tmp	.= $element;
			$out	= preg_replace( '/<%(\?)?' . preg_quote( $label, '/' ) . '%>/', $tmp, $out );	//  find placeholder and set in content
 		}
		$out = preg_replace( '/<%\?.*%>/U', '', $out );    											//  remove left over optional placeholders
#        $out = preg_replace( '/\n\s+\n/', "\n", $out );												//  remove double line breaks

		foreach( $this->plugins as $plugin )
			if( $plugin->type == 'post' )
				$out	= $plugin->work( $out );

		$tags = array();																			//  create container for left over placeholders
		if( preg_match_all( '/<%.*%>/U', $out, $tags ) === 0 )										//  no more placeholders left over
		    return $out; 																			//  return final result

		$tags	= array_shift( $tags );																//  
		foreach( $tags as $key => $value )
			$tags[$key]	= preg_replace( '@(<%\??)|%>@', "", $value );
		if( $this->fileName )
			throw new Exception_Template( Exception_Template::FILE_LABELS_MISSING, $this->fileName, $tags );
		throw new Exception_Template( Exception_Template::LABELS_MISSING, NULL, $tags );
	}
1173692
public static function create($nome, $documento, $endereco = null, $bairro = null, $cep = null, $cidade = null, $uf = null)
    {
        return new static([
            'nome' => $nome,
            'endereco' => $endereco,
            'bairro' => $bairro,
            'cep' => $cep,
            'uf' => $uf,
            'cidade' => $cidade,
            'documento' => $documento,
        ]);
    }
1139567
public function create($vastVersion = '2.0')
    {
        $xml = $this->createDomDocument();

        // root
        $root = $xml->createElement('VAST');
        $xml->appendChild($root);

        // version
        $vastVersionAttribute = $xml->createAttribute('version');
        $vastVersionAttribute->value = $vastVersion;
        $root->appendChild($vastVersionAttribute);

        // return
        return new Document($xml);
    }
1115418
public function generate($document)
    {
        $lexer = new Lexer();
        $tokenStream = $lexer->tokenize($document);
        $tokenParser = new TokenParser();
        $nodeStream = $tokenParser->parse($tokenStream);
        $nodeParser = new NodeParser();
        $this->classBuilder = $nodeParser->parse($nodeStream);
        $compiler = new Compiler($this->options);
        $this->streamWriter = $compiler->compile($this->classBuilder);

        return $this;
    }
1344063
public function transpileForm($markup)
    {
        $transpiledForm = new TranspiledForm($markup, $this->crawler, false, $this->uploadDir);

        // Return the result form object
        return $transpiledForm->getForm();
    }
1072611
protected function createDomDocumentFromHtml($html)
    {
        $document = new \DOMDocument('1.0', 'UTF-8');
        $internalErrors = libxml_use_internal_errors(true);
        if (!empty($html)) {
            $document->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
        }
        libxml_use_internal_errors($internalErrors);
        $document->formatOutput = true;

        return $document;
    }
935043
private function newInstance(DocumentMetadata $class)
    {
        $document = $class->newInstance();

        // inject ObjectManager upon refresh.
        if ($document instanceof ObjectManagerAware) {
            $document->injectObjectManager($this->manager, $class);
        }

        return $document;
    }
280696
public function generate($markup, $options = array()) {
        if( $markup instanceof MarkupInterface ) {
            $content = $markup->getContent();
        } else {
            $content = $markup;
        }

        $config = null;

        if( $options && count($otpions) > 0 )
            $config = $options;

        return $this->purifier->purify($content, $config);
    }
1304114
public function convert($markdown)
    {
        $root = new Container();

        $this->inlineParser = new InlineParser($this->links, $this->titles);
        $parser = $this->buildParserStack();

        $text = new Text($markdown);
        $this->prepare($text);

        $parser->parseBlock($text, $root);

        $this->inlineParser->parse();

        return $root;
    }
1187134
private static function createTypeElement(\DOMDocument $document, $parentElement = null, $type)
    {
        if ($parentElement->parentNode === null) {
            $typeElement = $document->createElementNS(
                'https://github.com/RhubarbPHP/Rhubarb/blob/master/docs/simple-xml-transcoder.md',
                self::XMLNS . ':' . $type
            );
            $parentElement->appendChild($typeElement);
        } else {
            $parentElement->setAttribute(self::XMLNS . ':' . self::ATTR_TYPE, $type);
            $typeElement = $parentElement;
        }

        return $typeElement;
    }
148834
public static function create($tagName, $content = '') {
		if (isset(self::$tagClassMap[$tagName])) {
			$class = self::$tagClassMap[$tagName];
			return new $class($content);
		} else {
			return new UnknownTag($tagName, $content);
		}
	}
359247
public static Document createDOMDocument()
    {
        try {
            return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException ex) {
            LOGGER.error("Cannot create DOM Documents", ex);
            return null;
        }
    }
961381
public static function createDocument( $name )
    {
        // Check if a document with the given name exists.
        if ( !isset( self::$documents[$name] ) )
        {
            throw new phpillowNoSuchPropertyException( $name );
        }

        // Instantiate and return document.
        $className = self::$documents[$name];
        return call_user_func( array( $className, 'createNew' ) );
    }