org.htmlparser.Tag.toHtml()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(142)

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

Tag.toHtml介绍

暂无

代码示例

代码示例来源:origin: org.opencms/opencms-core

/**
 * @see org.htmlparser.Node#toHtml(boolean)
 */
public String toHtml(boolean value) {
  return m_decorated.toHtml(value);
}

代码示例来源:origin: org.opencms/opencms-core

/**
 * @see org.htmlparser.Node#toHtml()
 */
public String toHtml() {
  return m_decorated.toHtml();
}

代码示例来源:origin: org.opencms/opencms-solr

/**
 * @see org.htmlparser.Node#toHtml(boolean)
 */
public String toHtml(boolean value) {
  return m_decorated.toHtml(value);
}

代码示例来源:origin: com.bbossgroups.pdp/pdp-cms

/**
 * @see org.htmlparser.Node#toHtml()
 */
public String toHtml() {
  return m_decorated.toHtml();
}

代码示例来源:origin: org.opencms/opencms-solr

/**
 * @see org.htmlparser.Node#toHtml()
 */
public String toHtml() {
  return m_decorated.toHtml();
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

/**
   * Add the textual contents of the end tag of this node to the buffer.
   * @param sb The buffer to append to.
   */
  protected void putEndTagInto(StringBuilder sb)
  {
    // eliminate virtual tags
//        if (!(endTag.getStartPosition () == endTag.getEndPosition ()))
      sb.append(getEndTag ().toHtml());
  }

代码示例来源:origin: org.everit.templating/org.everit.templating.html

private boolean handleTageInNoneAndInlineMode(final Tag tag) {
 boolean noneOrInlineTag = false;
 if ((visitMode == VisitMode.NONE) || (visitMode == VisitMode.INLINE)) {
  if (!tag.isEmptyXmlTag()) {
   visitorPath.add(new VisitorPathElement().withTag(tag));
  }
  if (visitMode == VisitMode.INLINE) {
   currentSB.append(tag.toHtml(true));
  }
  noneOrInlineTag = true;
 }
 return noneOrInlineTag;
}

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

public void visitEndTag(Tag tag)
{
  Node parent;
  
  parent = tag.getParent ();
  // process only those nodes not processed by a parent
  if (null == parent)
    // an orphan end tag
    modifiedResult.append(tag.toHtml());
  else
    if (null == parent.getParent ())
      // a top level tag with no parents
      modifiedResult.append(parent.toHtml());
}

代码示例来源:origin: org.everit.templating/org.everit.templating.html

int depth = visitorPath.size();
 if (depth > specialVisitDepth) {
  currentSB.append(tag.toHtml(true));
  return;
 currentSB.append(tag.toHtml(true));
} else {
 if (currentSB.length() > 0) {
 ((TagNode) beginTagPathElement.ewtNode).setEndTag(tag.toHtml(true));

代码示例来源:origin: com.bbossgroups/bboss-htmlparser

public void visitTag(Tag tag)
{
  if (tag instanceof LinkTag)
    ((LinkTag)tag).setLink(linkPrefix + ((LinkTag)tag).getLink());
  else if (tag instanceof ImageTag)
    ((ImageTag)tag).setImageURL(linkPrefix + ((ImageTag)tag).getImageURL());
  // process only those nodes that won't be processed by an end tag,
  // nodes without parents or parents without an end tag, since
  // the complete processing of all children should happen before
  // we turn this node back into html text
  if (null == tag.getParent ()
    && (!(tag instanceof CompositeTag) || null == ((CompositeTag)tag).getEndTag ()))
    modifiedResult.append(tag.toHtml());
}

代码示例来源:origin: brix-cms/brix-cms

private void processTag(List<AbstractContainer> nodes, int current, List<Item> items,
            org.htmlparser.Tag tag) {
  final Tag.Type type;
  final String rawName = tag.getRawTagName();
  if (rawName.startsWith("/")) {
    type = Tag.Type.CLOSE;
  } else if (isOpenClose(tag)) {
    type = Tag.Type.OPEN_CLOSE;
  } else {
    type = Tag.Type.OPEN;
  }
  final String tagName = tag.getTagName().toLowerCase();
  if ("!doctype".equals(tagName)) {
    this.doctype = tag.toHtml();
  } else if (type == Tag.Type.CLOSE) {
    if (!isKnownBrixTag(tagName)) {
      Map<String, String> attributes = Collections.emptyMap();
      items.add(new SimpleTag(tagName, type, attributes));
    }
  } else {
    Map<String, String> attributes = getAttributes(tag);
    if (isKnownBrixTag(tagName)) {
      processBrixTag(nodes, current, items, tagName, getAttributes(tag), type);
    } else {
      items.add(new SimpleTag(tagName, type, attributes));
    }
  }
}

代码示例来源:origin: deas/alfresco

buf.append(tag.getEndTag().toHtml());
if (tag.getEndTag() != null)
  buf.append(tag.getEndTag().toHtml());
buf.append(tag.toHtml());

代码示例来源:origin: org.alfresco.surf/spring-webscripts

buf.append(tag.getEndTag().toHtml());
buf.append(tag.getEndTag().toHtml());

代码示例来源:origin: org.springframework.extensions.surf/spring-webscripts

buf.append(tag.getEndTag().toHtml());
buf.append(tag.getEndTag().toHtml());

代码示例来源:origin: iipc/openwayback

/**
 * test expected behavior of htmlparser.
 * <p>htmlparser does neither unescape HTML entities found in text, nor
 * escape special characters in Node.toHtml().  We have a workaround based on this
 * behavior.  If this expectation breaks, we need to modify our code.</p>
 * @throws Exception
 */
public void testHtmlParser_attributeValueEscaping() throws Exception {
  final String html = "<html>" +
      "<body>" +
      "<a href=\"http://example.com/api?a=1&amp;b=2&c=3&#34;\">anchor</a>" +
      "</body>" +
      "</html>";
  byte[] bytes = html.getBytes();
  ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
  Page page = new Page(bais, "UTF-8");
  Lexer lexer = new Lexer(page);
  Node node;
  while ((node = lexer.nextNode()) != null) {
    if (node instanceof Tag) {
      Tag tag = (Tag)node;
      if (tag.getTagName().equalsIgnoreCase("A") && !tag.isEndTag()) {
        assertEquals("href", "http://example.com/api?a=1&amp;b=2&c=3&#34;", tag.getAttribute("HREF"));
        String htmlout = tag.toHtml();
        assertEquals("toHtml output", "<a href=\"http://example.com/api?a=1&amp;b=2&c=3&#34;\">", htmlout);
      }
    }
  }
}

代码示例来源:origin: omegat-org/omegat

flushbefors();
writeout(tag.toHtml());
if (tag.getEndTag() != null) {
  recurse = false;

相关文章