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
FieldsModifier and TypeFieldDescriptionprotected static final String[]List of elements to be ignored during the body text retrieval processing -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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 TypeMethodDescriptionvoidcharacters(char[] ch, int start, int length) voidendElement(String uri, String localName, String qName) getValue()Gets the value of the parsed datavoidstartElement(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, warningMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler- Throws:
SAXException
-
startElement
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException - Specified by:
startElementin interfaceContentHandler- Overrides:
startElementin classDefaultHandler- Throws:
SAXException
-
endElement
- Specified by:
endElementin interfaceContentHandler- Overrides:
endElementin classDefaultHandler- Throws:
SAXException
-
getValue
Gets the value of the parsed data- Returns:
- the value of the parsed data
-