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

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

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

Document.clone介绍

暂无

代码示例

代码示例来源:origin: qingyu1229/XSExtractor

public NextPageUrlParser(Document doc, String baseUrl) {
  this.doc = doc.clone();
  this.baseUrl = baseUrl;
  init();
}

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

public Document getDocumentClone() {
    Document newDoc = doc.clone();
    newDoc.attr(ExtNodeConstants.ATTR_DOC_REF, "doc-" + IdGenerator.createId());
    return newDoc;
  }
}

代码示例来源:origin: symphonyoss/symphony-java-client

public void parseMessage(String message) throws SymException {
  Document doc = Jsoup.parse(message);
  originalDoc = doc.clone();
  Element elementErrors = doc.body().getElementsByTag("errors").first();
  if (elementErrors != null) {
    if (elementErrors.outerHtml() != null)
      logger.debug("Errors found in message: {}", elementErrors.outerHtml());
  }
  //Lets remove the errors elements
  doc.select("errors").remove();
  elementMessageML = doc.select("messageML").first();
  if(elementMessageML==null)
    elementMessageML = doc.select("div").first();
  if (elementMessageML != null) {
    if (elementMessageML.outerHtml() != null)
      logger.debug("Doc parsed: {}", elementMessageML.outerHtml());
  } else {
    logger.error("Could not parse document for message {}", message);
    throw new SymException("Malformed message");
  }
  textDoc = new StringBuilder();
  stripTags(textDoc, elementMessageML.childNodes());
  textChunks = textDoc.toString().split("\\s+");
}

代码示例来源:origin: org.symphonyoss.symphony/symphony-client

public void parseMessage(String message) throws SymException {
  Document doc = Jsoup.parse(message);
  originalDoc = doc.clone();
  Element elementErrors = doc.body().getElementsByTag("errors").first();
  if (elementErrors != null) {
    if (elementErrors.outerHtml() != null)
      logger.debug("Errors found in message: {}", elementErrors.outerHtml());
  }
  //Lets remove the errors elements
  doc.select("errors").remove();
  elementMessageML = doc.select("messageML").first();
  if(elementMessageML==null)
    elementMessageML = doc.select("div").first();
  if (elementMessageML != null) {
    if (elementMessageML.outerHtml() != null)
      logger.debug("Doc parsed: {}", elementMessageML.outerHtml());
  } else {
    logger.error("Could not parse document for message {}", message);
    throw new SymException("Malformed message");
  }
  textDoc = new StringBuilder();
  stripTags(textDoc, elementMessageML.childNodes());
  textChunks = textDoc.toString().split("\\s+");
}

代码示例来源:origin: starlightknight/swagger-confluence

final Document transformedDocument = originalDocument.clone();

相关文章