public abstract class TextConstruct extends Object implements ITextConstruct
| Modifier and Type | Class and Description |
|---|---|
static class |
TextConstruct.ChildHandlerInfo
Return type for
getChildHandler(Attributes);
contains an element handler and a text construct. |
static class |
TextConstruct.RssFormat
Enumerates the kinds of restrictions on what HTML tags are allowed.
|
static class |
TextConstruct.Type
Defines the possible text construct types: TEXT, HTML, and XHTML.
|
| Constructor and Description |
|---|
TextConstruct() |
| Modifier and Type | Method and Description |
|---|---|
static TextConstruct |
create(int type,
String textOrHtml,
XmlBlob xhtml)
Creates a text construct.
|
abstract void |
generateAtom(XmlWriter w,
String elementName)
Generates XML in the Atom format.
|
abstract void |
generateRss(XmlWriter w,
String elementName,
TextConstruct.RssFormat rssFormat)
Generates XML in the RSS format.
|
static TextConstruct.ChildHandlerInfo |
getChildHandler(Attributes attrs)
Parses XML in the Atom format.
|
String |
getLang() |
abstract String |
getPlainText()
Returns a plain-text representation of this text construct.
|
abstract int |
getType()
Returns this text construct's type (text, HTML, or XHTML).
|
static TextConstruct |
html(String html)
Construct a new html text content with the given html.
|
abstract boolean |
isEmpty()
Returns
true if this text construct has no contents. |
static TextConstruct |
plainText(String text)
Construct a new plain text content with the given text.
|
void |
setLang(String v)
Specifies the human language that this text construct is written in.
|
static TextConstruct |
xhtml(XmlBlob div)
Construct a new Xhtml text content from the given div.
|
protected String lang
xml:lang.public abstract int getType()
getType in interface ITextConstructpublic abstract boolean isEmpty()
true if this text construct has no contents.public abstract String getPlainText()
getPlainText in interface ITextConstructpublic String getLang()
public void setLang(String v)
public static TextConstruct create(int type, String textOrHtml, XmlBlob xhtml)
type - the type of the new text construct (TEXT, HTML, or XHTML)textOrHtml - the contents to put in this text construct, if the type is
TEXT or HTML.
If type is XHTML, set this parameter to null.xhtml - the contents to put in this text construct, if the type is
XHTML.
If type is TEXT or HTML, set this parameter to null.TextConstruct, or null if invalid type.public static TextConstruct plainText(String text)
public static TextConstruct html(String html)
public static TextConstruct xhtml(XmlBlob div)
public abstract void generateAtom(XmlWriter w, String elementName) throws IOException
w - output writerelementName - Atom element nameIOExceptionpublic abstract void generateRss(XmlWriter w, String elementName, TextConstruct.RssFormat rssFormat) throws IOException
w - output writerelementName - RSS element namerssFormat - the restrictions on what HTML tags are allowedIOExceptionpublic static TextConstruct.ChildHandlerInfo getChildHandler(Attributes attrs) throws ParseException, IOException
attrs - XML attributes of the root TextConstruct node.
Used to determine the type of this node.ParseExceptionIOExceptionCopyright © 2012. All Rights Reserved.