public abstract class TextConstruct extends java.lang.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,
java.lang.String textOrHtml,
XmlBlob xhtml)
Creates a text construct.
|
abstract void |
generateAtom(XmlWriter w,
java.lang.String elementName)
Generates XML in the Atom format.
|
abstract void |
generateRss(XmlWriter w,
java.lang.String elementName,
TextConstruct.RssFormat rssFormat)
Generates XML in the RSS format.
|
static TextConstruct.ChildHandlerInfo |
getChildHandler(org.xml.sax.Attributes attrs)
Parses XML in the Atom format.
|
java.lang.String |
getLang() |
abstract java.lang.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(java.lang.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(java.lang.String text)
Construct a new plain text content with the given text.
|
void |
setLang(java.lang.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.
|
public abstract int getType()
getType
in interface ITextConstruct
public abstract boolean isEmpty()
true
if this text construct has no contents.public abstract java.lang.String getPlainText()
getPlainText
in interface ITextConstruct
public java.lang.String getLang()
public void setLang(java.lang.String v)
public static TextConstruct create(int type, java.lang.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(java.lang.String text)
public static TextConstruct html(java.lang.String html)
public static TextConstruct xhtml(XmlBlob div)
public abstract void generateAtom(XmlWriter w, java.lang.String elementName) throws java.io.IOException
w
- output writerelementName
- Atom element namejava.io.IOException
public abstract void generateRss(XmlWriter w, java.lang.String elementName, TextConstruct.RssFormat rssFormat) throws java.io.IOException
w
- output writerelementName
- RSS element namerssFormat
- the restrictions on what HTML tags are allowedjava.io.IOException
public static TextConstruct.ChildHandlerInfo getChildHandler(org.xml.sax.Attributes attrs) throws ParseException, java.io.IOException
attrs
- XML attributes of the root TextConstruct node.
Used to determine the type of this node.ParseException
java.io.IOException