public interface Content extends Element
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
Modifier and Type | Interface and Description |
---|---|
static class |
Content.Type
Used to identify the type of content
|
Modifier and Type | Method and Description |
---|---|
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.
|
java.lang.String |
getValue()
Returns the string value of this atom:content element
|
<T extends Element> |
getValueElement()
Return the value element or null if type="text", type="html" or type is
some non-XML media type
|
java.lang.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(java.lang.String type)
RFC4287: On the atom:content element, the value of the "type"
attribute MAY be one of "text", "html", or "xhtml".
|
Content |
setSrc(java.lang.String src)
RFC4287: atom:content MAY have a "src" attribute, whose value MUST
be an IRI reference.
|
Content |
setValue(java.lang.String value)
Set the string value of the atom:content element
|
<T extends Element> |
setValueElement(T value)
Set the value element of the content.
|
Content |
setWrappedValue(java.lang.String wrappedValue)
Set the string value of the atom:content with the enclosing div tag
|
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
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(java.lang.String type)
type
- The media typeMimeTypeParseException
- 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(java.lang.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 contentIRISyntaxException
- if the src value is malformedjavax.activation.DataHandler getDataHandler()
java.lang.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 encodingjava.lang.UnsupportedOperationException
- if type = text, html, xhtml, or any application/*+xml, or text/* typejava.lang.String getValue()
Content setValue(java.lang.String value)
value
- The string valuejava.lang.String getWrappedValue()
Content setWrappedValue(java.lang.String wrappedValue)
wrappedValue
- The string value with the wrapping div tagCopyright © 2010 - 2020 Adobe. All Rights Reserved