Java HTML Jsoup Element appendFragment(Element e, String fragment)

Here you can find the source of appendFragment(Element e, String fragment)

Description

append Fragment

License

Open Source License

Declaration

public static void appendFragment(Element e, String fragment) 

Method Source Code


//package com.java2s;
// it under the terms of the GNU Lesser General Public License as published by

import java.util.ArrayList;
import java.util.List;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.nodes.Node;

public class Main {
    public static void appendFragment(Element e, String fragment) {
        Element doc = Jsoup.parse(fragment);
        appendFragment(e, doc);/*from   www .  j av a  2  s  .  c om*/
    }

    public static void appendFragment(Element e, Element fragment) {
        List<Node> nodes = new ArrayList<>();
        nodes.addAll(fragment.childNodes());
        for (Node child : nodes) {
            e.appendChild(child);
        }
    }
}

Related

  1. addAllNodes(Element parent, List childNodes)
  2. addProperty(Map ret, Element element)
  3. addStyle(Element element, String styleToBeAdded)
  4. addTag(Element e, String tagName)
  5. appendText(Element element, StringBuffer stringBuffer)
  6. childrenByTag(final Element element, final String tag)
  7. collectItemRewards(final Element icontab, final BiConsumer collector)
  8. collectTextUntilNextTag(final Element header, final String nextTagName)