|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Content
Represents an atom:content element.
Atom has a very clearly defined and extremely flexible content model. The model allows for five basic types of content:
<content type="text"><content></content>
is interpreted as literal characer "<"
followed by the word "content", followed by the literal character ">".<content type="html"><b>content</b></content>
is interpreted as the
word "content" surrounded by the HTML <b>
and </b>
tags.<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml"><b>Content</b></div></content>
.<content type="application/xml"><a xmlns="..."><b><c/></b></a></content>
. The
content could, alternatively, be linked to via the src attribute,
<content type="application/xml" src="http://example.org/foo.xml"/>
.<content type="text/calendar">BEGIN:VCALENDAR...</content>
.<content type="image/jpeg">{Base64}</content>
.<content type="text/calendar" src="http://example.org/foo.cal"/>
,
<content type="image/jpeg" src="http://example.org/foo.jpg" />
Per RFC4287:
The "atom:content" element either contains or links to the content of the entry. The content of atom:content is Language-Sensitive. 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 } atomContent = atomInlineTextContent | atomInlineXHTMLContent | atomInlineOtherContent | atomOutOfLineContent
Nested Class Summary | |
---|---|
static class |
Content.Type
Used to identify the type of content |
Method Summary | ||
---|---|---|
Content.Type |
getContentType()
Returns the Content Type |
|
javax.activation.DataHandler |
getDataHandler()
Attempts to Base64 decode the string value of the content element. |
|
javax.activation.MimeType |
getMimeType()
RFC4287: On the atom:content element, the value of the "type" attribute MAY be one of "text", "html", or "xhtml". |
|
IRI |
getResolvedSrc()
Returns the fully qualified URI form of the content src attribute. |
|
IRI |
getSrc()
RFC4287: atom:content MAY have a "src" attribute, whose value MUST be an IRI reference. |
|
String |
getValue()
Returns the string value of this atom:content element |
|
|
getValueElement()
Return the value element or null if type="text", type="html" or type is some non-XML media type |
|
String |
getWrappedValue()
Return the string value of the atom:content element with the enclosing div tag if type="xhtml" |
|
Content |
setContentType(Content.Type type)
Set the Content Type |
|
Content |
setDataHandler(javax.activation.DataHandler dataHandler)
Sets the string value of the content element by Base64 encoding the specifed byte array. |
|
Content |
setMimeType(String type)
RFC4287: On the atom:content element, the value of the "type" attribute MAY be one of "text", "html", or "xhtml". |
|
Content |
setSrc(String src)
RFC4287: atom:content MAY have a "src" attribute, whose value MUST be an IRI reference. |
|
Content |
setValue(String value)
Set the string value of the atom:content element |
|
|
setValueElement(T value)
Set the value element of the content. |
|
Content |
setWrappedValue(String wrappedValue)
Set the string value of the atom:content with the enclosing div tag |
Methods inherited from interface org.apache.abdera.model.Element |
---|
declareNS, discard, getAttributes, getAttributeValue, getAttributeValue, getBaseUri, getDocument, getElements, getExtensionAttributes, getFirstChild, getFirstChild, getLanguage, getLanguageTag, getLocale, getMustPreserveWhitespace, getNamespaces, getNextSibling, getNextSibling, getParentElement, getPreviousSibling, getPreviousSibling, getQName, getResolvedBaseUri, getText, removeAttribute, removeAttribute, setAttributeValue, setAttributeValue, setBaseUri, setBaseUri, setLanguage, setMustPreserveWhitespace, setParentElement, setText, setText |
Methods inherited from interface org.apache.abdera.model.Base |
---|
addComment, clone, complete, getDefaultWriterOptions, getFactory, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
Content.Type getContentType()
Content setContentType(Content.Type type)
type
- The Content Type<T extends Element> T getValueElement()
<T extends Element> Content setValueElement(T value)
value
- The element to setjavax.activation.MimeType getMimeType()
Content setMimeType(String type)
type
- The media type
MimeTypeParseException
- if the media type is malformedIRI getSrc()
RFC4287: atom:content MAY have a "src" attribute, whose value MUST be an IRI reference. If the "src" attribute is present, atom:content MUST be empty. Atom Processors MAY use the IRI to retrieve the content and MAY choose to ignore remote content or to present it in a different manner than local content.
If the "src" attribute is present, the "type" attribute SHOULD be provided and MUST be a MIME media type, rather than "text", "html", or "xhtml".
IRISyntaxException
- if the src attribute value is malformedIRI getResolvedSrc()
IRISyntaxException
- if the src attribute value is malformedContent setSrc(String src)
RFC4287: atom:content MAY have a "src" attribute, whose value MUST be an IRI reference. If the "src" attribute is present, atom:content MUST be empty. Atom Processors MAY use the IRI to retrieve the content and MAY choose to ignore remote content or to present it in a different manner than local content.
If the "src" attribute is present, the "type" attribute SHOULD be provided and MUST be a MIME media type, rather than "text", "html", or "xhtml".
src
- The IRI to use as the src attribute value for the content
IRISyntaxException
- if the src value is malformedjavax.activation.DataHandler getDataHandler()
UnsupportedOperationException
- if type = text, html, xhtml, or any application/*+xml, or text/* typeContent setDataHandler(javax.activation.DataHandler dataHandler)
dataHandler
- The DataHandler for the binary content requiring Base64 encoding
UnsupportedOperationException
- if type = text, html, xhtml, or any application/*+xml, or text/* typeString getValue()
Content setValue(String value)
value
- The string valueString getWrappedValue()
Content setWrappedValue(String wrappedValue)
wrappedValue
- The string value with the wrapping div tag
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |