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
This handle parse a rich text to get only text nodes.
HTML expert is ignored.
Call
getValue()
to get parse string.-
Field Summary
Modifier and TypeFieldDescriptionprotected static final String[]
List of elements to be ignored during the body text retrieval processing -
Constructor Summary
ConstructorDescriptionCreates a rich text handlerRichTextHandler
(int excerptLength) Creates a rich text handler to parse a rich text with a limit a characters -
Method Summary
Modifier and TypeMethodDescriptionvoid
characters
(char[] ch, int start, int length) void
endElement
(String uri, String localName, String qName) 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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
__IGNORED_ELEMENTS
List of elements to be ignored during the body text retrieval processing
-
-
Constructor Details
-
RichTextHandler
public RichTextHandler()Creates a rich text handler -
RichTextHandler
Creates a rich text handler to parse a rich text with a limit a characters- Parameters:
excerptLength
- The length for content excerpt
-
-
Method Details
-
characters
- 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
- Specified by:
endElement
in interfaceContentHandler
- Overrides:
endElement
in classDefaultHandler
- Throws:
SAXException
-
getValue
Gets the value of the parsed data- Returns:
- the value of the parsed data
-