org.newsml.toolkit
Interface ContentItem

All Superinterfaces:
BaseNode, CatalogNode, CommentNode, HrefNode, IdNode, PrimaryNode

public interface ContentItem
extends BaseNode, CatalogNode, CommentNode, HrefNode, IdNode, PrimaryNode

News content for presentation to humans.

A content item represents a leaf node in the NewsML content tree: it either contains or points to actual content, such as a textual news story, a photo, or a video. If the content item contains the content, the content will be accessible through the getDataContent() method; otherwise, the content's URL will be available through the getHref() method.

The getMediaType(), getFormat(), and getNotation() methods all provide redundant information already available through getMimeType(), and provide that information in ways that will be less familiar to users; these redundant methods have been included only for the sake of completeness.

Version:
1.0
Author:
Reuters PLC

Fields inherited from interface org.newsml.toolkit.PrimaryNode
CONTENT_ITEM, NEWS_COMPONENT, NEWS_ITEM, NEWS_ITEM_REF, NEWSML
 
Method Summary
 Characteristics getCharacteristics()
          Get the physical characteristics of the news content.
 org.w3c.dom.NodeList getDataContent()
          Get the data for inline news content.
 java.lang.String getDataText()
          Get the text for inline news content.
 java.lang.String[] getEncoding()
          Get all Encoding children in an array.
 java.lang.String getEncoding(int index)
          Get an encoding step for the content.
 int getEncodingCount()
          Get the number of encoding steps for the content.
 FormalName getFormat()
          Get the content's format.
 java.lang.String getHref()
          Get the URL of the actual content.
 FormalName getMediaType()
          Get the content's media type.
 FormalName getMimeType()
          Return the content's MIME type.
 FormalName getNotation()
          Get the content's data type notation.
 
Methods inherited from interface org.newsml.toolkit.BaseNode
getSession, getXMLName
 
Methods inherited from interface org.newsml.toolkit.CatalogNode
getCatalog
 
Methods inherited from interface org.newsml.toolkit.CommentNode
getComment, getComment, getCommentCount
 
Methods inherited from interface org.newsml.toolkit.IdNode
getDuid, getEuid
 
Methods inherited from interface org.newsml.toolkit.PrimaryNode
asContentItem, asNewsComponent, asNewsItem, asNewsItemRef, asNewsML, getChild, getChild, getChildCount, getNodePath, getParent, getType
 

Method Detail

getHref

public java.lang.String getHref()
Get the URL of the actual content. If the actual content is not included inline in the NewsML package, this method will return the URL where the content can be found. This method and the getDataContent() methods are mutually exclusive: one of the two will always return null.
Specified by:
getHref in interface HrefNode
Returns:
The URL of the content, or null if the content is included inline.
See Also:
getDataContent()

getMediaType

public FormalName getMediaType()
Get the content's media type. NewsML media type information is redundant, filling the same function as the first part of the MIME type (see getMimeType()). Typical media types include Text, Audio, Video, and Image.
Returns:
A formal name representing the media type, or null if no media type was specified.
See Also:
getMimeType()

getFormat

public FormalName getFormat()
Get the content's format. NewsML format information is redundant, filling the same function as the second part of the MIME type (see getMimeType()). Typical media types include ANPA 1312 and NITF.
Returns:
A formal name describing the format, or null if no format was specified.
See Also:
getMimeType()

getMimeType

public FormalName getMimeType()
Return the content's MIME type. While this value is a formal name, and may be defined by any vocabulary according to the NewsML document type, it would be a very poor choice for a provider not to use the proper MIME-type definition in IETF RFC 2045.
Returns:
A formal name describing the MIME type, or null if no MIME type was specified.
See Also:
getCharacteristics()

getNotation

public FormalName getNotation()
Get the content's data type notation. NewsML notation information is redundant, filling the same role as the MIME type (see getMimeType()) but using a less familiar representation.
Returns:
A formal name describing the data type notation, or null if no notation was specified.
See Also:
getMimeType()

getCharacteristics

public Characteristics getCharacteristics()
Get the physical characteristics of the news content. Physical characteristics include the physical content's size in bytes. Note that information on media and format is provided by the MIME type (see getMimeType()).
Returns:
An object describing the physical characteristics, or null if none was specified.
See Also:
getMimeType()

getEncodingCount

public int getEncodingCount()
Get the number of encoding steps for the content.
Returns:
The number of encoding steps.

getEncoding

public java.lang.String getEncoding(int index)
Get an encoding step for the content. Content included inline may have one or more encoding steps applied to it, such as compression, encryption, or base-64 encoding. This method returns the steps sequentially, starting with the first one applied.
Parameters:
index - The index of the encoding, zero-based, numbered sequentially in document order.
Returns:
A string representing the encoding, or null if none was provided at the specified index.

getEncoding

public java.lang.String[] getEncoding()
Get all Encoding children in an array.
Returns:
A (possibly-empty) array of Encoding children.

getDataContent

public org.w3c.dom.NodeList getDataContent()
Get the data for inline news content. If the news content is included inline, this method will return a DOM NodeList for the content. This method and the getHref() method are mutually exclusive: one of the two will always return null.
Returns:
A DOM node list representing the news content, or null if no content was included inline.
See Also:
getHref(), getDataText()

getDataText

public java.lang.String getDataText()
Get the text for inline news content. This method returns only the text part of inline news content, ignoring any markup. It is useful when the inline content represents base-64-encoded binary files (such as graphics) rather than XML markup.
Returns:
A string containing the text of the news content, or null if the content was not provided inline.
See Also:
getDataContent(), getHref()