|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.odftoolkit.odfdom.dom.DefaultElementVisitor
org.odftoolkit.odfdom.incubator.doc.text.OdfTextExtractor
public class OdfTextExtractor
It's a sub class of DefaultElementVisitor. It provides a method to get the display text of a single element.
If you pass the content root as the parameter, the whole document content will be returned, without any tag information.
It implements part of white space handling fuctions: text:p, text:h, text:s, text:tab, text:linebreak are processed according to ODF specification.
| Field Summary | |
|---|---|
protected StringBuilder |
mTextBuilder
|
protected static char |
NewLineChar
|
protected static char |
TabChar
|
| Constructor Summary | |
|---|---|
protected |
OdfTextExtractor()
Default constructor |
protected |
OdfTextExtractor(OdfElement element)
Constructor with an ODF element as paramter |
| Method Summary | |
|---|---|
protected void |
appendElementText(OdfElement ele)
Append the text content of this element to string buffer. |
String |
getText()
Return the text content as a string |
static OdfTextExtractor |
newOdfTextExtractor(OdfElement element)
An instance of OdfTextExtractor will be created to extract the text content of an ODF element. |
void |
visit(OdfElement element)
Visit odf element and process some operations |
void |
visit(TextHElement ele)
A method to visit "text:h" elements |
void |
visit(TextLineBreakElement ele)
A method to visit "text:line-break" elements |
void |
visit(TextPElement ele)
A method to visit "text:p" elements |
void |
visit(TextSElement ele)
A method to visit "text:s" elements |
void |
visit(TextTabElement ele)
A method to visit "text:tab" elements |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected StringBuilder mTextBuilder
protected static final char NewLineChar
protected static final char TabChar
| Constructor Detail |
|---|
protected OdfTextExtractor()
protected OdfTextExtractor(OdfElement element)
element - the ODF element whose text would be extracted.| Method Detail |
|---|
protected void appendElementText(OdfElement ele)
ele - the ODF element whose text will be appended.public static OdfTextExtractor newOdfTextExtractor(OdfElement element)
element - the ODF element whose text will be extracted.
public void visit(OdfElement element)
ElementVisitor
visit in interface ElementVisitorvisit in class DefaultElementVisitorelement - ODF elementpublic void visit(TextPElement ele)
DefaultElementVisitor
visit in class DefaultElementVisitorele - - an instance of TextPElementpublic void visit(TextHElement ele)
DefaultElementVisitor
visit in class DefaultElementVisitorele - - an instance of TextHElementpublic void visit(TextSElement ele)
DefaultElementVisitor
visit in class DefaultElementVisitorele - - an instance of TextSElementpublic void visit(TextTabElement ele)
DefaultElementVisitor
visit in class DefaultElementVisitorele - - an instance of TextTabElementpublic void visit(TextLineBreakElement ele)
DefaultElementVisitor
visit in class DefaultElementVisitorele - - an instance of TextLineBreakElementpublic String getText()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||