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

x33g5p2x  于2022-01-29 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(107)

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

TextNode.createFromEncoded介绍

[英]Create a new TextNode from HTML encoded (aka escaped) data.
[中]

代码示例

代码示例来源:origin: dhanji/sitebricks

Node dataNode;
if (parent.tagName().equals(titleTag) || parent.tagName().equals(textareaTag))
 dataNode = TextNode.createFromEncoded(text, baseUri);
else // data not encoded but raw (for " in script)
 dataNode = new DataNode(text, baseUri);

代码示例来源:origin: com.google.sitebricks/sitebricks

Node dataNode;
if (parent.tagName().equals(titleTag) || parent.tagName().equals(textareaTag))
 dataNode = TextNode.createFromEncoded(text, baseUri);
else // data not encoded but raw (for " in script)
 dataNode = new DataNode(text, baseUri);

代码示例来源:origin: br.com.objectos/sitebricks

Node dataNode;
if (parent.tagName().equals(titleTag) || parent.tagName().equals(textareaTag))
 dataNode = TextNode.createFromEncoded(text, baseUri);
else // data not encoded but raw (for " in script)
 dataNode = new DataNode(text, baseUri);

代码示例来源:origin: dhanji/sitebricks

/** 
 * Break the text up by the first line delimiter.  We only want annotations applied to the first line of a block of text
 * and not to a whole segment.
 * 
 * @param text the text to turn into nodes
 * @param parent the parent node
 * @param annotation the current annotation to be applied to the first line of text
 */
private void addTextNodeToParent (String text, Element parent, AnnotationNode annotation)	{
  String [] lines = new String[] {text};
  
  if (annotation != null)
    lines = splitInTwo(text);
  
  for (int i = 0; i < lines.length; i++){
    TextNode textNode = TextNode.createFromEncoded(lines[i], baseUri);
    lines(textNode, lines[i]);
    
    // apply the annotation and reset it to null
    if (annotation != null && i == 0)
      annotation.apply(textNode);
    
    // put the text node on the parent
    parent.appendChild(textNode);
  }
}

代码示例来源:origin: com.google.sitebricks/sitebricks

/** 
 * Break the text up by the first line delimiter.  We only want annotations applied to the first line of a block of text
 * and not to a whole segment.
 * 
 * @param text the text to turn into nodes
 * @param parent the parent node
 * @param annotation the current annotation to be applied to the first line of text
 */
private void addTextNodeToParent (String text, Element parent, AnnotationNode annotation)	{
  String [] lines = new String[] {text};
  
  if (annotation != null)
    lines = splitInTwo(text);
  
  for (int i = 0; i < lines.length; i++){
    TextNode textNode = TextNode.createFromEncoded(lines[i], baseUri);
    lines(textNode, lines[i]);
    
    // apply the annotation and reset it to null
    if (annotation != null && i == 0)
      annotation.apply(textNode);
    
    // put the text node on the parent
    parent.appendChild(textNode);
  }
}

代码示例来源:origin: br.com.objectos/sitebricks

/** 
 * Break the text up by the first line delimiter.  We only want annotations applied to the first line of a block of text
 * and not to a whole segment.
 * 
 * @param text the text to turn into nodes
 * @param parent the parent node
 * @param annotation the current annotation to be applied to the first line of text
 */
private void addTextNodeToParent (String text, Element parent, AnnotationNode annotation)	{
  String [] lines = new String[] {text};
  
  if (annotation != null)
    lines = splitInTwo(text);
  
  for (int i = 0; i < lines.length; i++){
    TextNode textNode = TextNode.createFromEncoded(lines[i], baseUri);
    lines(textNode, lines[i]);
    
    // apply the annotation and reset it to null
    if (annotation != null && i == 0)
      annotation.apply(textNode);
    
    // put the text node on the parent
    parent.appendChild(textNode);
  }
}

代码示例来源:origin: br.com.objectos/sitebricks

private void parseTextNode() {
 String text = tq.consumeTo("<");
 String annotationText = AnnotationParser.readAnnotation(text);
 text = AnnotationParser.stripAnnotation(text);
 if (text.length() > 0) {
  TextNode textNode = TextNode.createFromEncoded(text, baseUri);
  // if (pendingAnnotation != null) { pendingAnnotation.apply(textNode); }
  lines(textNode, text);
  add(textNode);
 }
 if (null != annotationText) {
  AnnotationNode annotation = new AnnotationNode(annotationText);
  lines(annotation, annotationText);
  add(annotation);
 }
}

代码示例来源:origin: dhanji/sitebricks

private void parseTextNode() {
 String rawText = tq.consumeTo("<");
 String annotationText = AnnotationParser.readAnnotation(rawText);
 String text = AnnotationParser.stripAnnotation(rawText);
 if (text.length() > 0) {
  TextNode textNode = TextNode.createFromEncoded(text, baseUri);
  // if (pendingAnnotation != null) { pendingAnnotation.apply(textNode); }
  lines(textNode, rawText);
  add(textNode);
 }
 if (null != annotationText) {
  AnnotationNode annotation = new AnnotationNode(annotationText);
  lines(annotation, annotationText);
  add(annotation);
 }
}

代码示例来源:origin: com.google.sitebricks/sitebricks

private void parseTextNode() {
 String rawText = tq.consumeTo("<");
 String annotationText = AnnotationParser.readAnnotation(rawText);
 String text = AnnotationParser.stripAnnotation(rawText);
 if (text.length() > 0) {
  TextNode textNode = TextNode.createFromEncoded(text, baseUri);
  // if (pendingAnnotation != null) { pendingAnnotation.apply(textNode); }
  lines(textNode, rawText);
  add(textNode);
 }
 if (null != annotationText) {
  AnnotationNode annotation = new AnnotationNode(annotationText);
  lines(annotation, annotationText);
  add(annotation);
 }
}

相关文章