Class A_CmsConfiguredHtmlParser
- java.lang.Object
-
- org.opencms.jsp.parse.A_CmsConfiguredHtmlParser
-
public abstract class A_CmsConfiguredHtmlParser extends java.lang.Object
Base class for all classes that are specified for the <cms:parse parserClass="name" param="config" /> tag in the parserClass Attribute.Entry point for the tag implementation (
CmsJspTagParse
). The tag will provide a validCmsObject
and it's configuration parameter String to subclasses of this instances. Implementations just choose the type ofI_CmsHtmlNodeVisitor
they will use for visiting the content to be parsed.To implement a custom class that may be used with the
<cms:parse parserClass="name" param="config" /> tag the only thing that has to be done is to implement the methodcreateVisitorInstance()
and return the desiredI_CmsHtmlNodeVisitor
implementation.- Since:
- 6.1.7
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
A_CmsConfiguredHtmlParser()
Default constructor that initializes the internal visitor by using the abstract template methodcreateVisitorInstance()
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract I_CmsHtmlNodeVisitor
createVisitorInstance()
Subclasses have to create their desired instance for parsing the html here.java.lang.String
doParse(java.lang.String html, java.lang.String encoding, java.util.List<java.lang.String> noAutoCloseTags)
Returns the result of subsequent parsing to the <cms:parse< tag implementation.protected CmsObject
getCmsObject()
Returns the internal cms object for accessing core functionality.protected java.lang.String
getParam()
Returns the param.protected I_CmsHtmlNodeVisitor
getVisitor()
Returns the visitor.void
setCmsObject(CmsObject cmsObject)
Sets the internal cms object for accessing core functionality.void
setParam(java.lang.String param)
The attribute value of the attribute param of the <cms:parse> tag.
-
-
-
Constructor Detail
-
A_CmsConfiguredHtmlParser
protected A_CmsConfiguredHtmlParser()
Default constructor that initializes the internal visitor by using the abstract template methodcreateVisitorInstance()
.
-
-
Method Detail
-
createVisitorInstance
protected abstract I_CmsHtmlNodeVisitor createVisitorInstance() throws CmsException
Subclasses have to create their desired instance for parsing the html here.You have access to
getCmsObject()
andgetParam()
already here and may pass those to the visitor to return.- Returns:
- the instance to be used for parsing the html
- Throws:
CmsException
- if sth. goes wrong
-
doParse
public java.lang.String doParse(java.lang.String html, java.lang.String encoding, java.util.List<java.lang.String> noAutoCloseTags) throws org.htmlparser.util.ParserException, CmsException
Returns the result of subsequent parsing to the <cms:parse< tag implementation.- Parameters:
encoding
- the encoding to use for parsinghtml
- the html content to parsenoAutoCloseTags
- a list of upper case tag names for which parsing / visiting should not correct missing closing tags.- Returns:
- the result of subsequent parsing to the <cms:parse< tag implementation
- Throws:
org.htmlparser.util.ParserException
- if something goes wrong at parsingCmsException
- if something goes wrong at accessing OpenCms core functionality
-
getCmsObject
protected CmsObject getCmsObject()
Returns the internal cms object for accessing core functionality.This value will be initialized by the <cms:parse> tag.
- Returns:
- the internal cms object for accessing core functionality
-
getParam
protected java.lang.String getParam()
Returns the param.- Returns:
- the param
-
getVisitor
protected I_CmsHtmlNodeVisitor getVisitor()
Returns the visitor.- Returns:
- the visitor
-
setCmsObject
public void setCmsObject(CmsObject cmsObject)
Sets the internal cms object for accessing core functionality.This will be invokde by the &tl;cms:parse> tag implementation.
- Parameters:
cmsObject
- the internal cms object for accessing core functionality to set
-
setParam
public void setParam(java.lang.String param)
The attribute value of the attribute param of the <cms:parse> tag.Will be set by the <cms:parse> implementation.
- Parameters:
param
- the param to set
-
-