org.newsml.toolkit
Interface OriginNode

All Superinterfaces:
BaseNode, IdNode, IdText, Text
All Known Subinterfaces:
AssignedOriginText, Origin, OriginText

public interface OriginNode
extends IdText

Mixed content text and Origin elements.

This interface provides a base for specialized text (possibly) containing mixed content: text mixed in with Origin subelements that can be made into hyperlinks. It is still possible to treat this as simple text, but this interface exposes the Origin subelements for applications that need them.

Version:
2.0
Author:
Reuters PLC

Field Summary
static int ORIGIN
          Constant: a chunk is an origin element.
static int TEXT
          Constant: a chunk contains text.
 
Method Summary
 int getChunkCount()
          Get the number of separate content chunks.
 int getChunkType(int index)
          Get the type of a chunk.
 String getData(int index)
          Get a chunk as plain text.
 Origin getOrigin(int index)
          Get a chunk as an Origin subelement.
 
Methods inherited from interface org.newsml.toolkit.Text
setBoolean, setInt, setString, toBoolean, toInt, toString
 
Methods inherited from interface org.newsml.toolkit.BaseNode
getAttr, getChild, getChild, getChild, getChild, getChildCount, getChildCount, getParent, getPath, getSession, getXMLName, getXPath, insertAfter, insertAfter, insertAfter, insertAfter, insertAfterDuid, insertAfterDuid, insertBefore, insertBefore, insertBefore, insertBefore, insertBeforeDuid, insertBeforeDuid, insertChild, insertChild, insertFirst, insertFirst, insertLast, insertLast, removeChild, removeChild, removeSelf, replaceChild, replaceChild, replaceChild, replaceChild, replaceChild, replaceChild, setAttr, setAttr, toXML, toXML, unsetAttr, unsetAttr, writeXML, writeXML
 
Methods inherited from interface org.newsml.toolkit.IdNode
getDuid, getEuid
 

Field Detail

TEXT

public static final int TEXT
Constant: a chunk contains text.

ORIGIN

public static final int ORIGIN
Constant: a chunk is an origin element.
Method Detail

getChunkCount

public int getChunkCount()
Get the number of separate content chunks.

Note that text may be broken down into an arbitrary number of chunks by the DOM implementation: it is not safe to assume that all contiguous text will appear in the same chunk.

Returns:
The number of content chunks (0 for an empty element).

getChunkType

public int getChunkType(int index)
Get the type of a chunk.
Parameters:
index - The index of the chunk.
Returns:
One of TEXT or ORIGIN, representing the chunk's type, or -1 if the index is out of range.

getData

public String getData(int index)
Get a chunk as plain text.

For any index, only one of this method and getOrigin(int) may return non-null

Parameters:
index - The index of the chunk.
Returns:
The chunk as a string, or null if the chunk is an Origin element or the index is out of range.
See Also:
getOrigin(int)

getOrigin

public Origin getOrigin(int index)
Get a chunk as an Origin subelement.
Parameters:
index - The index of the chunk.
Returns:
The chunk as an Origin object, or null if the chunk is text or if the index is out of range.