Class Content
The content element contains or links to the complete content of an entry. It supports multiple content types and delivery methods:
- Inline text content - Plain text or HTML content embedded in the feed
- Inline XHTML content - Well-formed XHTML embedded in the feed
- Inline other content - Other media types (XML, base64-encoded binary, etc.)
- Out-of-line content - Link to external content via the
src attribute
The
"text" - Plain text (default)"html" - HTML, entity-escaped"xhtml" - XHTML wrapped in a div element- Other MIME types - For multimedia content or base64-encoded data
Schema
atomContent = atomInlineTextContent | atomInlineXHTMLContent | atomInlineOtherContent | atomOutOfLineContent atomInlineTextContent = element atom:content { atomCommonAttributes, attribute type { "text" | "html" }?, (text)* } atomInlineXHTMLContent = element atom:content { atomCommonAttributes, attribute type { "xhtml" }, xhtmlDiv } atomInlineOtherContent = element atom:content { atomCommonAttributes, attribute type { atomMediaType }?, (text|anyElement)* } atomOutOfLineContent = element atom:content { atomCommonAttributes, attribute type { atomMediaType }?, attribute src { atomUri }, empty }
Examples:
Specification:
Represents an
See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSrc()
Bean property getter:src .Bean property setter:base .Bean property setter:lang .Bean property setter:src .Bean property setter:text .Bean property setter:type .
-
Constructor Details
-
Content
Normal content.- Parameters:
type
- The content type of this content.
-
Content
public Content()Normal content.
-
-
Method Details
-
getSrc
Bean property getter:src .Returns the URI of externally-hosted content (out-of-line content).
When
src is present, the content is not embedded in the feed but is instead referenced by URI. This is useful for large media files or content hosted elsewhere.- Returns:
- The property value, or
null if it is not set.
-
setSrc
Bean property setter:src .Sets the URI of externally-hosted content (out-of-line content).
The value can be of any of the following types:
URI
,URL
,String
. Strings must be valid URIs.Example:
// Link to external video Contentcontent =new Content() .setType("video/mp4" ) .setSrc("http://example.org/videos/intro.mp4" );- Parameters:
value
- The new value for this property.
Can benull to unset the property.- Returns:
- This object.
-
setText
Description copied from class:Text
Bean property setter:text .The content of this content.
-
setType
Description copied from class:Text
Bean property setter:type .The content type of this content.
Must be one of the following:
"text" "html" "xhtml" null (defaults to"text" )
-
setBase
Description copied from class:Common
-
setLang
Description copied from class:Common
Bean property setter:lang .Sets the natural language of the element's content (xml:lang attribute).
Example:
Text
title =new Text("text" ) .setText("Mon Blog" ) .setLang("fr" );
-