Creates and adds a text node
        @param root:Element Root element
        @param name:str Tag name
        @param value:object Text value
        @param cdata:bool A value indicating whether to use CDATA or not.
        @return:Node
4604
def _create_text_node(self, root, name, value, cdata=False):
        '''
        
        '''
        if is_empty_or_none(value):
            return

        if type(value) == date:
            value = date_to_string(value)

        if type(value) == datetime:
            value = datetime_to_string(value)

        if isinstance(value, Decimal):
            value = "0" if not value else str(value)

        tag = root.ownerDocument.createElement(name)
        value = value.decode('utf-8')
        if cdata:
            tag.appendChild(root.ownerDocument.createCDATASection(value))
        else:
            tag.appendChild(root.ownerDocument.createTextNode(value))

        return root.appendChild(tag)
1350832
private function addNewXmlElement(DOMDocument $dom, DOMElement $node, $name, $value)
    {
        $new = $dom->createElement($name);
        $new->appendChild($dom->createTextNode($value));
        $node->appendChild($new);
    }
103771
def data(self, root):
        ''''''
        value = self.dict()
        children = [node for node in root if isinstance(node.tag, basestring)]
        for attr, attrval in root.attrib.items():
            attr = attr if self.attr_prefix is None else self.attr_prefix + attr
            value[attr] = self._fromstring(attrval)
        if root.text and self.text_content is not None:
            text = root.text.strip()
            if text:
                if self.simple_text and len(children) == len(root.attrib) == 0:
                    value = self._fromstring(text)
                else:
                    value[self.text_content] = self._fromstring(text)
        count = Counter(child.tag for child in children)
        for child in children:
            if count[child.tag] == 1:
                value.update(self.data(child))
            else:
                result = value.setdefault(child.tag, self.list())
                result += self.data(child).values()
        # if simple_text, elements with no children nor attrs become '', not {}
        if isinstance(value, dict) and not value and self.simple_text:
            value = ''
        return self.dict([(root.tag, value)])
866547
public function addNode($parentNode, $name, $value = false)
    {
        // if $parentNode is a string, it is likely to be
        // an XPath expression. If so, it is converted
        // into a DOMElement.
        if (is_string($parentNode)) {
            if ($parentNode == "/") {
                $parentNode = $this->domDocument;
            } else {
                $parentNode = $this->getNode($parentNode);
            }
        }

        if ($parentNode) {
            try {
                $newNode = $this->domDocument->createElement($name);
                if (!is_array($value) && !is_resource($value)) {
                    $newNode->appendChild(
                        $this->domDocument->createTextNode($value)
                    );
                }

                return $parentNode->appendChild($newNode);
            } catch (\DOMException $exception) {
                throw new Dom\Exception("Could not add node named '$name'.");
            }
        } else {
            throw new Dom\Exception("Parent node not found: " . $parentNode);
        }
    }
1283146
public static Text createTextNode(String value)
   {
      Document doc = getOwnerDocument();
      return doc.createTextNode(value);
   }
423222
private static List<Node> getChildren(Node parentNode, String name, String value){
                List<Node> childNodes = new ArrayList<Node>();
                if(parentNode == null || name == null){
                        return childNodes;
                }

                if (parentNode.getNodeType() == Node.ELEMENT_NODE && parentNode.hasChildNodes()) {
                        NodeList children = parentNode.getChildNodes();
                        for(int i=0; i < children.getLength(); i++){
                                Node child = children.item(i);
                                if(child != null && name.equals(child.getNodeName()) && (value == null || value.equals(child.getTextContent()))){
                                        childNodes.add(child);
                                }
                        }
                }

                return childNodes;
        }
1180769
public static HtmlTree A_NAME(String name, Content body) {
        HtmlTree htmltree = HtmlTree.A_NAME(name);
        htmltree.addContent(nullCheck(body));
        return htmltree;
    }
900919
function text(element) {
  var type = element.nodeType
    , value = '';

  if (1 === type || 9 === type || 11 === type) {
    //
    // Use `textContent` instead of `innerText` as it's inconsistent with new
    // lines.
    //
    if ('string' === typeof element.textContent) return element.textContent;

    for (element = element.firstChild; element; element = element.nextSibling) {
      value += text(element);
    }
  }

  return 3 === type || 4 === type
  ? element.nodeValue
  : value;
}
868564
public static org.w3c.dom.Document getW3cDocument(JsonElement value, String rootName) {
        Element root = getElement(value, rootName);
        try {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setNamespaceAware(true);
            DocumentBuilder builder = factory.newDocumentBuilder();
            DOMImplementation impl = builder.getDOMImplementation();

            return DOMConverter.convert(new Document(root), impl);
        } catch (ParserConfigurationException e) {
            throw new IllegalStateException(e);
        }
    }
1109416
function text(node) {
  var data = node.data || {}

  if (
    own.call(data, 'hName') ||
    own.call(data, 'hProperties') ||
    own.call(data, 'hChildren')
  ) {
    return false
  }

  return 'value' in node
}
518532
public static Element createRootElement(String tagName) throws AlipayApiException {
        Document doc = newDocument();
        Element root = doc.createElement(tagName);
        doc.appendChild(root);
        return root;
    }
1137832
public static Document mapToXml(Map<?, ?> data, String rootName) {
		final Document doc = createXml();
		final Element root = appendChild(doc, rootName);

		mapToXml(doc, root, data);
		return doc;
	}
1326754
function text (factory, node, cursor) {
    // Process a text node. 
    var parentNode = node.parentNode;

    // If the node is CDATA convert it to text.
    if (node.nodeType == 4) {
      var text = factory.createTextNode(node.data);
      parentNode.insertBefore(text, node);
      parentNode.removeChild(node);
      node = text;
    }

    var prev = node.previousSibling;
    if (node.nodeType == 3) {
      // Combine adjacent text nodes. You'll notice that this means that we
      // might be reaching outside the range givne to us to normalize. That is
      // if fine. The boundary is guidance to save time, not a firewall.
      if (prev != null && prev.nodeType == 3) {
        var text = factory.createTextNode(prev.data + node.data);
        if (prev == cursor.node) {
          cursor.node = text;
        }
        parentNode.insertBefore(text, prev);
        parentNode.removeChild(prev);
        parentNode.removeChild(node);
        node = text;
      }

      // Remove duplicate whitespace.
      if (/\s\s/.test(node.data)) {
        var text = factory.createTextNode(node.data.replace(/\s\s+/g, " "));
        parentNode.insertBefore(text, node);
        parentNode.removeChild(node);
        node = text;
      }
    }

    return node;
  }
1255808
def node(self, name, label=None, _attributes=None, **attrs):
        
        name = self._quote(name)
        attr_list = self._attr_list(label, attrs, _attributes)
        line = self._node % (name, attr_list)
        self.body.append(line)
1005635
private void textPath(Attributes attributes) throws SVGParseException
   {
      debug("<textPath>");

      if (currentElement == null)
         throw new SVGParseException("Invalid document. Root element must be <svg>");
      SVG.TextPath  obj = new SVG.TextPath();
      obj.document = svgDocument;
      obj.parent = currentElement;
      parseAttributesCore(obj, attributes);
      parseAttributesStyle(obj, attributes);
      parseAttributesConditional(obj, attributes);
      parseAttributesTextPath(obj, attributes);
      currentElement.addChild(obj);
      currentElement = obj;
      if (obj.parent instanceof TextRoot)
         obj.setTextRoot((TextRoot) obj.parent);
      else
         obj.setTextRoot(((TextChild) obj.parent).getTextRoot());
   }
1217599
function( tagName, text ){
			var node = this.document.createElement(tagName);
			node.innerHTML = text;
			return node;
		}
276521
public static void addOrSetAttribute(final AttributesImpl atts, final QName name, final String value) {
        addOrSetAttribute(atts, name.getNamespaceURI(), name.getLocalPart(), name.getPrefix()  + ":" + name.getLocalPart(), "CDATA", value);
    }