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
|
DataHandler |
getDataHandler()
Attempts to Base64 decode the string value of the content element.
|
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
|
<T extends 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(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
|
<T extends 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
|
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, setTextaddComment, clone, complete, getDefaultWriterOptions, getFactory, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeTo, writeToforEach, iterator, spliteratorContent.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 setMimeType getMimeType()
Content setMimeType(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(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 malformedDataHandler getDataHandler()
UnsupportedOperationException - if type = text, html, xhtml, or any application/*+xml, or text/* typeContent setDataHandler(DataHandler dataHandler)
dataHandler - The DataHandler for the binary content requiring Base64 encodingUnsupportedOperationException - if type = text, html, xhtml, or any application/*+xml, or text/* typeString getValue()
Content setValue(String value)
value - The string valueString getWrappedValue()
Copyright © 2010 - 2020 Adobe. All Rights Reserved