/** * @see org.htmlparser.visitors.NodeVisitor#visitStringNode(org.htmlparser.Text) */ @Override public void visitStringNode(Text text) { appendText(text.toPlainTextString()); }
private void appendAttribute(Tag tag, String text) { if (tag.getTagName().equals("IMG")) { appendText(text); } else { String current = (String)m_attributeMap.get(tag); if (current != null) { text = current + text; } m_attributeMap.put(tag, text); } }
/** * @see org.htmlparser.visitors.NodeVisitor#visitStringNode(org.htmlparser.Text) */ @Override public void visitStringNode(Text text) { appendText(text.toPlainTextString()); }
/** * Appends an attribute.<p> * * @param tag the tag * @param text the attribute text */ private void appendAttribute(Tag tag, String text) { if (tag.getTagName().equals("IMG")) { appendText(text); } else { String current = m_attributeMap.get(tag); if (current != null) { text = current + text; } m_attributeMap.put(tag, text); } }
/** * @see org.htmlparser.visitors.NodeVisitor#visitEndTag(org.htmlparser.Tag) */ @Override public void visitEndTag(Tag tag) { m_appendBr = false; appendLinebreaks(tag, false); String attribute = m_attributeMap.remove(tag.getParent()); if (attribute != null) { appendText(attribute); } }
/** * @see org.htmlparser.visitors.NodeVisitor#visitEndTag(org.htmlparser.Tag) */ @Override public void visitEndTag(Tag tag) { m_appendBr = false; appendLinebreaks(tag, false); String attribute = (String)m_attributeMap.remove(tag.getParent()); if (attribute != null) { appendText(attribute); } }
/** * @see org.htmlparser.visitors.NodeVisitor#visitTag(org.htmlparser.Tag) */ @Override public void visitTag(Tag tag) { m_appendBr = true; appendLinebreaks(tag, true); if (tag.getTagName().equals("IMG")) { appendText("##IMG##"); } String href = tag.getAttribute("href"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(href)) { appendAttribute(tag, " [" + href.trim() + "]"); } String src = tag.getAttribute("src"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(src)) { appendAttribute(tag, " [" + src.trim() + "]"); } String title = tag.getAttribute("title"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(title)) { appendAttribute(tag, " {" + title.trim() + "}"); } String alt = tag.getAttribute("alt"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(alt)) { appendAttribute(tag, " {" + alt.trim() + "}"); } }
/** * @see org.htmlparser.visitors.NodeVisitor#visitTag(org.htmlparser.Tag) */ @Override public void visitTag(Tag tag) { m_appendBr = true; appendLinebreaks(tag, true); if (tag.getTagName().equals("IMG")) { appendText("##IMG##"); } String href = tag.getAttribute("href"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(href)) { appendAttribute(tag, " [" + href.trim() + "]"); } String src = tag.getAttribute("src"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(src)) { appendAttribute(tag, " [" + src.trim() + "]"); } String title = tag.getAttribute("title"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(title)) { appendAttribute(tag, " {" + title.trim() + "}"); } String alt = tag.getAttribute("alt"); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(alt)) { appendAttribute(tag, " {" + alt.trim() + "}"); } }
if (open) { appendLinebreak(1); appendText("-----"); appendLinebreak(1); if (!open) { appendLinebreak(1); appendText("-----"); appendLinebreak(1);
if (open) { appendLinebreak(1); appendText("-----"); appendLinebreak(1); if (!open) { appendLinebreak(1); appendText("-----"); appendLinebreak(1);