Construct a new (empty) DOM Document and return it.

@return an empty DOM Document
359247
public static Document createDOMDocument()
    {
        try {
            return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
        } catch (ParserConfigurationException ex) {
            LOGGER.error("Cannot create DOM Documents", ex);
            return null;
        }
    }
588871
function Element(doc, name, content) {
    if (!doc) {
        throw new Error('document argument required');
    } else if (! (doc instanceof bindings.Document)) {
        throw new Error('document argument must be an ' +
                        'instance of Document');
    } else if (!name) {
        throw new Error('name argument required');
    }

    return new bindings.Element(doc, name, content);
}
1152584
@Override
  public ScriptElement createScriptElement(Document doc, String source) {
    ScriptElement elem = (ScriptElement) createElement(doc, "script");
    elem.setInnerText(source);
    return elem;
  }
334837
private static Element createResultElement(final Document document) {
        return document.createElementNS(JaxRxConstants.URL, JaxRxConstants.JAXRX + ":results");
    }
1094910
public Document getDocument(@NonNull String id) {
        if (id == null) { throw new IllegalArgumentException("id cannot be null."); }

        synchronized (lock) {
            mustBeOpen();
            try {
                return new Document((Database) this, id, false);
            }
            catch (CouchbaseLiteException ex) {
                // only 404 - Not Found error throws CouchbaseLiteException
                return null;
            }
        }
    }
292710
public static Element toElement(Document doc, Object o) throws PageException {
	if (o instanceof Element) return (Element) o;
	else if (o instanceof Node) throw new ExpressionException("Object " + Caster.toClassName(o) + " must be a XML Element");
	return doc.createElement(Caster.toString(o));
    }
7433
@NotNull
    public static DocumentBuilder createDocumentBuilder() {
        try {
            final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            return factory.newDocumentBuilder();
        } catch (final ParserConfigurationException ex) {
            throw new RuntimeException("Couldn't create document builder", ex);
        }
    }
566666
@Override
  public DocumentDescriptor create(DocumentUriTemplate template, W contentHandle)
    throws ForbiddenUserException, FailedRequestException {
    return create(template, null, contentHandle, null, null, null, null, null);
  }
378887
function createDocument(root, namespace) {
    if (!root)
      return document.implementation.createHTMLDocument();
    else
      return document.implementation.createDocument(
        namespace || null,
        root,
        null
      );
  }
531751
function (dom) {
            var html = '';
            dom.forEach(function (node) {
                if (node.type === 'tag') {
                    var tag = node.name;
                    html += '<' + tag;
                    Object.keys(node.attribs).forEach(function (attr) {
                        html += ' ' + attr + '=' + this.generateAttribute(node.attribs[attr]);
                    }, this);
                    html += (voidTags[tag] ? '/>' : '>');
                    if (!voidTags[tag]) {
                        html += this.vdomToHtml(node.children);
                        html += '</' + tag + '>';
                    }
                } else if (node.type === 'text') {
                    var text = node.data || '';
                    html += this.htmlEncode(text); //escape <,> and &.
                } else if (node.type === 'comment') {
                    html += '<!-- ' + node.data.trim() + ' -->';
                } else if (node.type === 'script' || node.type === 'style') {
                    //No need to escape text inside script or style tag.
                    html += '<' + node.name;
                    Object.keys(node.attribs).forEach(function (attr) {
                        html += ' ' + attr + '=' + this.generateAttribute(node.attribs[attr]);
                    }, this);
                    html += '>' + ((node.children[0] || {}).data || '') + '</' + node.name + '>';
                } else if (node.type === 'directive') {
                    html += '<' + node.data + '>';
                }
            }, this);
            return html;
        }
1095975
function () {
            var t = this,
                documentSelection = t.doc.getSelection(),
                node = documentSelection.focusNode,
                text = new XMLSerializer().serializeToString(documentSelection.getRangeAt(0).cloneContents()),
                url,
                title,
                target;

            while (['A', 'DIV'].indexOf(node.nodeName) < 0) {
                node = node.parentNode;
            }

            if (node && node.nodeName === 'A') {
                var $a = $(node);
                text = $a.text();
                url = $a.attr('href');
                if (!t.o.minimalLinks) {
                    title = $a.attr('title');
                    target = $a.attr('target');
                }
                var range = t.doc.createRange();
                range.selectNode(node);
                documentSelection.removeAllRanges();
                documentSelection.addRange(range);
            }

            t.saveRange();

            var options = {
                url: {
                    label: 'URL',
                    required: true,
                    value: url
                },
                text: {
                    label: t.lang.text,
                    value: text
                }
            };
            if (!t.o.minimalLinks) {
                Object.assign(options, {
                    title: {
                        label: t.lang.title,
                        value: title
                    },
                    target: {
                        label: t.lang.target,
                        value: target
                    }
                });
            }

            t.openModalInsert(t.lang.createLink, options, function (v) { // v is value
                var url = t.prependUrlPrefix(v.url);
                if (!url.length) {
                    return false;
                }

                var link = $(['<a href="', url, '">', v.text || v.url, '</a>'].join(''));

                if (!t.o.minimalLinks) {
                    if (v.title.length > 0) {
                        link.attr('title', v.title);
                    }
                    if (v.target.length > 0) {
                        link.attr('target', v.target);
                    }
                }
                t.range.deleteContents();
                t.range.insertNode(link[0]);
                t.syncCode();
                t.$c.trigger('tbwchange');
                return true;
            });
        }
351401
public Document createRaw(@NonNull String content) {
      return createRaw(StringUtils.EMPTY, content, defaultLanguage, Collections.emptyMap());
   }
1306577
public function getDocument()
    {
        if ($this->node->ownerDocument === null) {
            return null;
        }

        return new Document($this->node->ownerDocument);
    }
307644
function( document ){
			var newNode,
				newDocument = null;

			if( this.canCloneDocument( document )){
				newDocument = document.implementation.createHTMLDocument('');
				newNode = newDocument.importNode( document.documentElement, true );
				newDocument.replaceChild(newNode, newDocument.querySelector('html'));
			}
			return (newNode && newNode.nodeType && newNode.nodeType === 1)? newDocument : document;
		}
1017055
public static EditableDocument newDocument( Document original ) {
        BasicDocument newDoc = new BasicDocument();
        newDoc.putAll(original);
        return new DocumentEditor(newDoc, DEFAULT_FACTORY);
    }
510973
function create() {
    var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';

    return document.createElement(tag);
}
775267
function createElement(name, props) {
		var c = document,
			d = c.createElement(name);
		if (props && "[object Object]" === Object.prototype.toString.call(props)) {
			var e;
			for (e in props)
				if ("html" === e) d.innerHTML = props[e];
				else if ("text" === e) {
				var f = c.createTextNode(props[e]);
				d.appendChild(f);
			} else d.setAttribute(e, props[e]);
		}
		return d;
	}