Class OdfWhitespaceProcessor
java.lang.Object
org.odftoolkit.odfdom.incubator.doc.text.OdfWhitespaceProcessor
It's a tool class to help process white space.
- Author:
- J David Eisenberg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add given text content to an element, handling multiple blanks, tabs, and newlines properly.static void
appendText
(Element element, String content) Append text content to a given element, handling whitespace properly.Retrieve the text content of an element.
-
Constructor Details
-
OdfWhitespaceProcessor
public OdfWhitespaceProcessor()
-
-
Method Details
-
append
Add given text content to an element, handling multiple blanks, tabs, and newlines properly.- Parameters:
element
- the element to which content is being addedcontent
- text content including whitespace
-
getText
Retrieve the text content of an element. Recursively retrieves all the text nodes, expanding whitespace where necessary. Ignores any elements except<text:s>
,<text:line-break>
and<text:tab>
.- Parameters:
element
- an element whose text you want to retrieve- Returns:
- the element's text content, with whitespace expanded
-
appendText
Append text content to a given element, handling whitespace properly. This is a static method that creates its own OdfWhitespaceProcessor, so that you don't have to.- Parameters:
element
- the element to which content is being addedcontent
- text content including whitespace
-