Here you can find the source of updateData(Element element, String data)
public static Element updateData(Element element, String data)
//package com.java2s; //License from project: Apache License import org.jsoup.nodes.DataNode; import org.jsoup.nodes.Element; import java.util.List; public class Main { /**/*from ww w.ja v a 2s .c o m*/ * Update given element's data to new data. */ public static Element updateData(Element element, String data) { List<DataNode> dataNodes = element.dataNodes(); for (DataNode dataNode : dataNodes) { dataNode.setWholeData(""); } dataNodes.get(0).setWholeData(data); return element; } }