/** * @see org.opencms.util.CmsHtmlParser#visitTag(org.htmlparser.Tag) */ @Override public void visitTag(Tag tag) { boolean change = m_settings.replace(tag); if (change) { m_changedContent = true; } super.visitTag(tag); }
/** * @see org.opencms.util.I_CmsHtmlNodeVisitor#visitTag(org.htmlparser.Tag) */ @Override public void visitTag(Tag tag) { if (m_echo) { m_result.append(getTagHtml(tag)); } }
/** * @see org.opencms.util.CmsHtmlParser#visitEndTag(org.htmlparser.Tag) */ @Override public void visitEndTag(Tag tag) { boolean change = m_settings.replace(tag); if (change) { m_changedContent = true; } super.visitEndTag(tag); }
/** * @see org.opencms.util.I_CmsHtmlNodeVisitor#process(java.lang.String, java.lang.String) */ public String process(String html, String encoding) throws ParserException { m_result = new StringBuffer(); Parser parser = new Parser(); Lexer lexer = new Lexer(); // initialize the page with the given char set Page page = new Page(html, encoding); lexer.setPage(page); parser.setLexer(lexer); if (m_noAutoCloseTags != null && m_noAutoCloseTags.size() > 0) { // Degrade Composite tags that do have children in the DOM tree // to simple single tags: This allows to finish this tag with opened HTML tags without the effect // that html parser will generate the closing tags. PrototypicalNodeFactory factory = configureNoAutoCorrectionTags(); lexer.setNodeFactory(factory); } // process the page using the given visitor parser.visitAllNodesWith(this); // return the result return getResult(); }
CmsHtmlParser visitor = new CmsHtmlParser(true); parser.visitAllNodesWith(visitor); return visitor.getResult();
/** * @see org.opencms.util.I_CmsHtmlNodeVisitor#process(java.lang.String, java.lang.String) */ public String process(String html, String encoding) throws ParserException { m_result = new StringBuffer(); Parser parser = new Parser(); Lexer lexer = new Lexer(); // initialize the page with the given char set Page page = new Page(html, encoding); lexer.setPage(page); parser.setLexer(lexer); if ((m_noAutoCloseTags != null) && (m_noAutoCloseTags.size() > 0)) { // Degrade Composite tags that do have children in the DOM tree // to simple single tags: This allows to finish this tag with opened HTML tags without the effect // that html parser will generate the closing tags. PrototypicalNodeFactory factory = configureNoAutoCorrectionTags(); lexer.setNodeFactory(factory); } // process the page using the given visitor parser.visitAllNodesWith(this); // return the result return getResult(); }
CmsHtmlParser visitor = new CmsHtmlParser(true); parser.visitAllNodesWith(visitor); return visitor.getResult();
/** * @see org.htmlparser.visitors.NodeVisitor#visitTag(org.htmlparser.Tag) */ @Override public void visitTag(Tag tag) { super.visitTag(tag); // get the tagname String tagname = tag.getTagName(); // this is one of the tags that should not allow decoation if (m_config.isExcluded(tagname)) { m_decorate = false; } else { m_decorate = true; } }
/** * @see org.opencms.util.I_CmsHtmlNodeVisitor#visitEndTag(org.htmlparser.Tag) */ @Override public void visitEndTag(Tag tag) { if (m_echo) { m_result.append(getTagHtml(tag)); } }
/** * @see org.htmlparser.visitors.NodeVisitor#visitTag(org.htmlparser.Tag) */ @Override public void visitTag(Tag tag) { super.visitTag(tag); // get the tagname String tagname = tag.getTagName(); // this is one of the tags that should not allow decoation if (m_config.isExcluded(tagname)) { m_decorate = false; } else { m_decorate = true; } }
/** * @see org.opencms.util.I_CmsHtmlNodeVisitor#visitEndTag(org.htmlparser.Tag) */ @Override public void visitEndTag(Tag tag) { if (m_echo) { m_result.append(getTagHtml(tag)); } }
/** * Visitor method to process a tag (start).<p> * * @param tag the tag to process */ @Override public void visitTag(Tag tag) { if (tag instanceof LinkTag) { processLinkTag((LinkTag)tag); } else if (tag instanceof ImageTag) { processImageTag((ImageTag)tag); } else if (tag instanceof ObjectTag) { processObjectTag((ObjectTag)tag); } else { // there are no specialized tag classes for these tags :( if (TAG_EMBED.equals(tag.getTagName())) { processEmbedTag(tag); } else if (TAG_AREA.equals(tag.getTagName())) { processAreaTag(tag); } } // append text content of the tag (may have been changed by above methods) super.visitTag(tag); }
/** * @see org.opencms.util.I_CmsHtmlNodeVisitor#visitTag(org.htmlparser.Tag) */ @Override public void visitTag(Tag tag) { if (m_echo) { m_result.append(getTagHtml(tag)); } }
/** * Visitor method to process a tag (start).<p> * * @param tag the tag to process */ @Override public void visitTag(Tag tag) { if (tag instanceof LinkTag) { processLinkTag((LinkTag)tag); } else if (tag instanceof ImageTag) { processImageTag((ImageTag)tag); } else if (tag instanceof ObjectTag) { processObjectTag((ObjectTag)tag); } else { // there are no specialized tag classes for these tags :( if (TAG_EMBED.equals(tag.getTagName())) { processEmbedTag(tag); } else if (TAG_AREA.equals(tag.getTagName())) { processAreaTag(tag); } } // append text content of the tag (may have been changed by above methods) super.visitTag(tag); }