Java XML Element Set setTextContent(Element elem, String content)

Here you can find the source of setTextContent(Element elem, String content)

Description

set Text Content

License

Apache License

Declaration

public static void setTextContent(Element elem, String content) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.*;

public class Main {
    public static void setTextContent(Element elem, String content) {
        Document doc = elem.getOwnerDocument();
        if ((content != null) && !content.equals("")) {
            Text textNode = doc.createTextNode(content);
            elem.appendChild(textNode);/*from ww w.  j a v a2s.co  m*/
        }
    }
}

Related

  1. setText(Element elem, String value)
  2. setText(Element element, String data)
  3. setText(Element element, String text)
  4. setText(Element element, String text)
  5. setText(Element element, String text)
  6. setTextContent(Element elem, String value)
  7. setTextContent(Element element, String content)
  8. setTextContent(Element element, String content)
  9. setTextContent(Element element, String text)