Class CmsTagReplaceParser
java.lang.Object
org.htmlparser.visitors.NodeVisitor
org.opencms.util.CmsHtmlParser
org.opencms.workplace.tools.content.CmsTagReplaceParser
- All Implemented Interfaces:
org.opencms.util.I_CmsHtmlNodeVisitor
Html parser / visitor combination that visits a document and replaces Tag names by using the
replacement configuration of a
CmsTagReplaceSettings
instance.
Instances are reusable.
- Since:
- 6.1.7
-
Field Summary
Fields inherited from class org.opencms.util.CmsHtmlParser
m_echo, m_noAutoCloseTags, m_result, TAG_ARRAY, TAG_LIST
-
Constructor Summary
ConstructorDescriptionCmsTagReplaceParser
(CmsTagReplaceSettings settings) Default constructor that turns echo on and uses the settings for replacing tags. -
Method Summary
Modifier and TypeMethodDescriptiongetTagHtml
(org.htmlparser.Tag tag) Overridden to also return the attributes of the Tag.boolean
Returns the changedContent.Extracts the text from the given html content, assuming the given html encoding.void
visitEndTag
(org.htmlparser.Tag tag) void
visitTag
(org.htmlparser.Tag tag) Methods inherited from class org.opencms.util.CmsHtmlParser
collapse, configureNoAutoCorrectionTags, getConfiguration, getNoAutoCloseTags, getResult, setConfiguration, setNoAutoCloseTags, visitRemarkNode, visitStringNode
Methods inherited from class org.htmlparser.visitors.NodeVisitor
beginParsing, finishedParsing, shouldRecurseChildren, shouldRecurseSelf
-
Constructor Details
-
CmsTagReplaceParser
Default constructor that turns echo on and uses the settings for replacing tags.- Parameters:
settings
- the settings to use for tag replacement.
-
-
Method Details
-
getTagHtml
Overridden to also return the attributes of the Tag.- Overrides:
getTagHtml
in classorg.opencms.util.CmsHtmlParser
- See Also:
-
CmsHtmlParser.getTagHtml(org.htmlparser.Tag)
-
process
Extracts the text from the given html content, assuming the given html encoding.Additionally tags are replaced / removed according to the configuration of this instance.
Please note:
There are static process methods in the superclass that will not do the replacements / removals. Don't mix them up with this method.- Specified by:
process
in interfaceorg.opencms.util.I_CmsHtmlNodeVisitor
- Overrides:
process
in classorg.opencms.util.CmsHtmlParser
- Parameters:
html
- the content to extract the plain text from.encoding
- the encoding to use.- Returns:
- the text extracted from the given html content.
- Throws:
org.htmlparser.util.ParserException
- if something goes wrong.
-
visitEndTag
- Specified by:
visitEndTag
in interfaceorg.opencms.util.I_CmsHtmlNodeVisitor
- Overrides:
visitEndTag
in classorg.opencms.util.CmsHtmlParser
- See Also:
-
CmsHtmlParser.visitEndTag(org.htmlparser.Tag)
-
visitTag
- Specified by:
visitTag
in interfaceorg.opencms.util.I_CmsHtmlNodeVisitor
- Overrides:
visitTag
in classorg.opencms.util.CmsHtmlParser
- See Also:
-
CmsHtmlParser.visitTag(org.htmlparser.Tag)
-
isChangedContent
Returns the changedContent.- Returns:
- the changedContent
-