public abstract class

TextConstruct

extends Object
implements ITextConstruct
java.lang.Object
   ↳ com.google.gdata.data.TextConstruct
Known Direct Subclasses

Class Overview

Abstract base class for text construct type.

Summary

Nested Classes
class TextConstruct.ChildHandlerInfo Return type for getChildHandler(Attributes); contains an element handler and a text construct. 
enum TextConstruct.RssFormat Enumerates the kinds of restrictions on what HTML tags are allowed. 
class TextConstruct.Type Defines the possible text construct types: TEXT, HTML, and XHTML. 
Fields
protected String lang Language.
Public Constructors
TextConstruct()
Public Methods
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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gdata.data.ITextConstruct

Fields

protected String lang

Language. Derived from the current state of xml:lang.

Public Constructors

public TextConstruct ()

Public Methods

public static TextConstruct create (int type, String textOrHtml, XmlBlob xhtml)

Creates a text construct. This method is convenient for some service implementations. Note that XHTML is treated somewhat differently from text and HTML.

Parameters
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.
Returns

public abstract void generateAtom (XmlWriter w, String elementName)

Generates XML in the Atom format.

Parameters
w Output writer
elementName Atom element name
Throws
IOException

public abstract void generateRss (XmlWriter w, String elementName, TextConstruct.RssFormat rssFormat)

Generates XML in the RSS format.

Parameters
w Output writer
elementName RSS element name
rssFormat The restrictions on what HTML tags are allowed
Throws
IOException

public static TextConstruct.ChildHandlerInfo getChildHandler (Attributes attrs)

Parses XML in the Atom format.

Parameters
attrs XML attributes of the root TextConstruct node. Used to determine the type of this node.
Returns
  • a child handler
Throws
IOException
ParseException

public String getLang ()

Returns
  • the human language that this text construct is written in

public abstract String getPlainText ()

Returns a plain-text representation of this text construct.

public abstract int getType ()

Returns this text construct's type (text, HTML, or XHTML).

Returns
  • an integer value of 1 to represent TEXT, 2 to represent HTML, or 3 to represent XHTML.

public static TextConstruct html (String html)

Construct a new html text content with the given html.

Parameters
html

public abstract boolean isEmpty ()

Returns true if this text construct has no contents.

public static TextConstruct plainText (String text)

Construct a new plain text content with the given text.

Parameters
text

public void setLang (String v)

Specifies the human language that this text construct is written in.

Parameters
v

public static TextConstruct xhtml (XmlBlob div)

Construct a new Xhtml text content from the given div.

Parameters
div