Creation of a new node element within a document. @ns and
           @content are optional (None).
500285
def newDocRawNode(self, ns, name, content):
        
        if ns is None: ns__o = None
        else: ns__o = ns._o
        ret = libxml2mod.xmlNewDocRawNode(self._o, ns__o, name, content)
        if ret is None:raise treeError('xmlNewDocRawNode() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
1178260
function createErrorNode() {
        var el = document.createElement(this.config.tagNameError);
        el.classList.add(this.config.classError);
        return el;
    }
1370605
function(value) {
		var wrapper = createElement('div');
		wrapper.innerHTML = ''+value;

		// trim extraneous whitespace
		trimWhitespace(wrapper);

		// eliminate wrapper for single nodes
		if (wrapper.childNodes.length === 1) {
			return wrapper.firstChild;
		}

		// create a document fragment to hold elements
		var frag = createElement('');
		while (wrapper.firstChild) {
			frag.appendChild(wrapper.firstChild);
		}
		return frag;
	}
843279
function(markup) {

	var container = document.createElement('div');
	container.innerHTML = markup;

	return new NWTNodeInstance(container.childNodes[0]);
}
1217599
function( tagName, text ){
			var node = this.document.createElement(tagName);
			node.innerHTML = text;
			return node;
		}
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));
    }
510973
function create() {
    var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';

    return document.createElement(tag);
}
1026069
def append(node)
      if node.is_a?(EndTag)
        return if empty_tag?(node.name)
        po = @pos
        while po.parent and po.name != node.name
          po = po.parent
        end
        if po.name == node.name
          @pos = po.parent
        end
      else
        rexml = to_rexml(node)

        # if node is second root element, add root element wrap html tag
        if rexml.is_a?(REXML::Element) and @pos == @doc and @doc.root
          if @doc.root.name != 'html'
            html = REXML::Element.new
            html.name = "html"
            i = @doc.root.index_in_parent-1
            while pos = @doc.delete_at(i)
              @doc.delete_element(pos) if pos.is_a?(REXML::Element)
              html << pos
            end
            @doc << html
            @pos = html
          end
          @pos = @doc.root
        end
        @pos << rexml
        if rexml.is_a?(REXML::Element) and !empty_tag?(node.name) and !node.empty?
          @pos = rexml
        end
      end
    end
655405
def _create_xml_node(tag, prefix=None, ns=None):
    """"""
    if prefix and ns:
        ET.register_namespace(prefix, ns)
    if ns:
        return ET.Element("{"+ns+"}"+tag)
    else:
        return ET.Element(tag)
107692
function createElement(tagName) {
  return function (...args) {
    const element  = document.createElement(tagName);
    const attrs    = isObject(args[0]) ? args[0] : {};
    const children = args.length === 2 ? args[1] : args[0];

    Object
      .keys(attrs)
      .forEach(name => element.setAttribute(name, attrs[name]));

    if (Array.isArray(children)) {
      children.forEach(node => append(element, node));
    }

    if (isString(children) && !isVoidElement(tagName.toLowerCase())) {
      append(element, children);
    }

    return element;
  };
}
549212
def newDocComment(self, content):
        
        ret = libxml2mod.xmlNewDocComment(self._o, content)
        if ret is None:raise treeError('xmlNewDocComment() failed')
        __tmp = xmlNode(_obj=ret)
        return __tmp
428940
def add(ns, element_name, value, attributes={})
      element = REXML::Element.new(element_name)
      if ns.is_a?(Namespace)
        unless ns.prefix.nil? || ns.prefix.empty?
          element.name = "#{ns.prefix}:#{element_name}"
          element.add_namespace ns.prefix, ns.uri unless @ns == ns || @ns == ns.uri
        else
          element.add_namespace ns.uri unless @ns == ns || @ns == ns.uri
        end
      else
        element.add_namespace ns unless @ns == ns || @ns.to_s == ns
      end
      if value.is_a?(Element)
        value.elem.each_element do |e|
          element.add e.deep_clone
        end
        value.elem.attributes.each_attribute do |a|
          unless a.name =~ /^xmlns(?:\:)?/
            element.add_attribute a
          end
        end
        #element.text = value.elem.text unless value.elem.text.nil?
        text = value.elem.get_text
        unless text.nil?
          element.text = REXML::Text.new(text.to_s, true, nil, true)
        end
      else
        if value.is_a?(REXML::Element)
          element.add_element value.deep_clone
        else
          element.add_text value.to_s
        end
      end
      element.add_attributes attributes unless attributes.nil?
      @elem.add_element element
    end
1014022
public Node<T> node(T content) {
    final Node<T> search = nodes.get(content);
    if (search != null)
      return search;
    final Node<T> n = new Node<>(content, this);
    nodes.put(content, n);
    return n;
  }
394332
def createElementNS(self, namespace, qname):
        '''
        
        '''
        document = self._getOwnerDocument()
        node = document.createElementNS(namespace, qname)
        return ElementProxy(self.sw, node)
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;
	}
599181
function element(node, options = {}) {
  const { namespace } = options;
  const { tagName, properties, children = [] } = node;
  const el = typeof namespace !== 'undefined'
    ? document.createElementNS(namespace, tagName)
    : document.createElement(tagName);

  // Add HTML attributes
  const props = Object.keys(properties);
  const { length } = props;
  for (let i = 0; i < length; i += 1) {
    const key = props[i];
    const {
      attribute,
      property,
      mustUseAttribute,
      mustUseProperty,
      boolean,
      booleanish,
      overloadedBoolean,
      // number,
      // defined,
      commaSeparated,
      spaceSeparated,
      // commaOrSpaceSeparated,
    } = info.find(info.html, key) || {
      attribute: key,
      property: key,
    };

    let value = properties[key];
    if (Array.isArray(value)) {
      if (commaSeparated) {
        value = value.join(', ');
      } else if (spaceSeparated) {
        value = value.join(' ');
      } else {
        value = value.join(' ');
      }
    }

    try {
      if (mustUseProperty) {
        el[property] = value;
      }
      if (boolean || (overloadedBoolean && typeof value === 'boolean')) {
        if (value) {
          el.setAttribute(attribute, '');
        } else {
          el.removeAttribute(attribute);
        }
      } else if (booleanish) {
        el.setAttribute(attribute, value);
      } else if (value === true) {
        el.setAttribute(attribute, '');
      } else if (value || value === 0 || value === '') {
        el.setAttribute(attribute, value);
      }
    } catch (e) {
      if (!mustUseAttribute && property) {
        el[property] = value;
      }
      // Otherwise silently ignore
    }
  }

  // Transform children
  const { length: childrenLength } = children;
  for (let i = 0; i < childrenLength; i += 1) {
    const childEl = transform(children[i], options);
    if (childEl) {
      el.appendChild(childEl);
    }
  }

  return el;
}
1271803
def create_node(name, parent=None, ns='', tail=False, text=False):
    
    node = etree.Element(etree.QName(ns, name))
    if parent is not None:
        parent.append(node)
    if tail:
        node.tail = tail
    if text:
        node.text = text
    return node