Package org.ametys.cms.content
Class RichTextHandler
- java.lang.Object
-
- org.xml.sax.helpers.DefaultHandler
-
- org.ametys.cms.content.RichTextHandler
-
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
public class RichTextHandler extends DefaultHandler
This handle parse a rich text to get only text nodes. HTML expert is ignored. CallgetValue()
to get parse string.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String[]
__IGNORED_ELEMENTS
List of elements to be ignored during the body text retrieval processing
-
Constructor Summary
Constructors Constructor Description RichTextHandler()
Creates a rich text handlerRichTextHandler(int excerptLength)
Creates a rich text handler to parse a rich text with a limit a characters
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
characters(char[] ch, int start, int length)
void
endElement(String uri, String localName, String qName)
String
getValue()
Gets the value of the parsed datavoid
startElement(String uri, String localName, String qName, Attributes attributes)
-
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
-
-
-
-
Field Detail
-
__IGNORED_ELEMENTS
protected static final String[] __IGNORED_ELEMENTS
List of elements to be ignored during the body text retrieval processing
-
-
Constructor Detail
-
RichTextHandler
public RichTextHandler()
Creates a rich text handler
-
RichTextHandler
public RichTextHandler(int excerptLength)
Creates a rich text handler to parse a rich text with a limit a characters- Parameters:
excerptLength
- The length for content excerpt
-
-
Method Detail
-
characters
public void characters(char[] ch, int start, int length) throws SAXException
- Specified by:
characters
in interfaceContentHandler
- Overrides:
characters
in classDefaultHandler
- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException
- Specified by:
startElement
in interfaceContentHandler
- Overrides:
startElement
in classDefaultHandler
- Throws:
SAXException
-
endElement
public void endElement(String uri, String localName, String qName) throws SAXException
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
-