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
ConstructorsConstructorDescriptionCmsTagReplaceParser(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.booleanReturns the changedContent.Extracts the text from the given html content, assuming the given html encoding.voidvisitEndTag(org.htmlparser.Tag tag) voidvisitTag(org.htmlparser.Tag tag) Methods inherited from class org.opencms.util.CmsHtmlParser
collapse, configureNoAutoCorrectionTags, getConfiguration, getNoAutoCloseTags, getResult, setConfiguration, setNoAutoCloseTags, visitRemarkNode, visitStringNodeMethods 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:
getTagHtmlin classorg.opencms.util.CmsHtmlParser- See Also:
-
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:
processin interfaceorg.opencms.util.I_CmsHtmlNodeVisitor- Overrides:
processin 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:
visitEndTagin interfaceorg.opencms.util.I_CmsHtmlNodeVisitor- Overrides:
visitEndTagin classorg.opencms.util.CmsHtmlParser- See Also:
-
visitTag
- Specified by:
visitTagin interfaceorg.opencms.util.I_CmsHtmlNodeVisitor- Overrides:
visitTagin classorg.opencms.util.CmsHtmlParser- See Also:
-
isChangedContent
Returns the changedContent.- Returns:
- the changedContent
-