org.jsoup.nodes.Element.prependElement()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(156)

本文整理了Java中org.jsoup.nodes.Element.prependElement()方法的一些代码示例,展示了Element.prependElement()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.prependElement()方法的具体详情如下:
包路径:org.jsoup.nodes.Element
类名称:Element
方法名:prependElement

Element.prependElement介绍

[英]Create a new element by tag name, and add it as the first child.
[中]按标记名创建新元素,并将其添加为第一个子元素。

代码示例

代码示例来源:origin: org.jsoup/jsoup

/**
 Normalise the document. This happens after the parse phase so generally does not need to be called.
 Moves any text content that is not in the body element into the body.
 @return this document after normalisation
 */
public Document normalise() {
  Element htmlEl = findFirstElementByTagName("html", this);
  if (htmlEl == null)
    htmlEl = appendElement("html");
  if (head() == null)
    htmlEl.prependElement("head");
  if (body() == null)
    htmlEl.appendElement("body");
  // pull text nodes out of root, html, and head els, and push into body. non-text nodes are already taken care
  // of. do in inverse order to maintain text order.
  normaliseTextNodes(head());
  normaliseTextNodes(htmlEl);
  normaliseTextNodes(this);
  normaliseStructure("head", htmlEl);
  normaliseStructure("body", htmlEl);
  
  ensureMetaCharsetElement();
  
  return this;
}

代码示例来源:origin: astamuse/asta4d

public Element prependElement(String tagName) {
  return originElement.prependElement(tagName);
}

代码示例来源:origin: USPTO/PatentPublicData

element.attr("id", "TBL-" + Strings.padStart(String.valueOf(i), 4, '0'));
Element colGroup = element.prependElement("colgroup");
for (Element spec : element.select("colspec")) {
  colGroup.appendElement("col").attr("width", spec.attr("colwidth")).attr("align", spec.attr("align"));

代码示例来源:origin: USPTO/PatentPublicData

element.attr("id", "TBL-" + Strings.padStart(String.valueOf(i), 4, '0'));
Element colGroup = element.prependElement("colgroup");
for (Element spec : element.select("colspec")) {
  colGroup.appendElement("col").attr("width", spec.attr("colwidth")).attr("align", spec.attr("align"));

代码示例来源:origin: USPTO/PatentPublicData

element.attr("id", "TBL-" + Strings.padStart(String.valueOf(i), 4, '0'));
Element colGroup = element.prependElement("colgroup");
for (Element spec : element.select("colspec")) {
  colGroup.appendElement("col").attr("width", spec.attr("colwidth")).attr("align", spec.attr("align"));

相关文章

微信公众号

最新文章

更多

Element类方法