org.newsml.toolkit
Interface DataContent

All Superinterfaces:
BaseNode, IdNode

public interface DataContent
extends BaseNode, IdNode

Raw inline data in leaf content.

Currently, this interface returns the raw inline data as a DOM node list. That will be awkward for some implementations, especially for any future implementations not based on a DOM tree. Possible future alternatives include returning all of the inline data as a string, and providing mechanisms for decoding encoded inline data (i.e. base64 and similar) to produce binary objects.

Version:
1.1beta
Author:
Reuters PLC

Method Summary
 org.w3c.dom.NodeList getDOMNodes()
          Get the inline data as a list of DOM nodes.
 String getText()
          Get the inline data as plain text, ignoring any XML markup.
 String getXMLString()
          Get the inline data as a fragment of XML markup.
 
Methods inherited from interface org.newsml.toolkit.BaseNode
getChild, getChild, getChild, getChild, getChildCount, getChildCount, getParent, getPath, getSession, getXMLName, getXPath, removeSelf, toXML, toXML, writeXML, writeXML
 
Methods inherited from interface org.newsml.toolkit.IdNode
getDuid, getEuid
 

Method Detail

getDOMNodes

public org.w3c.dom.NodeList getDOMNodes()
Get the inline data as a list of DOM nodes.

This method may return more than one top-level node, possibly accompanied by text and whitespace.

Returns:
The list of DOM nodes inside the DataContent element.

getText

public String getText()
Get the inline data as plain text, ignoring any XML markup.

This method is most useful when the inline content is base64-encoded binary data or something similar, where XML markup is not relevant and XML character escaping is undesirable.

Returns:
A string of raw text, with no XML character escaping.

getXMLString

public String getXMLString()
Get the inline data as a fragment of XML markup.

This method is most useful when the inline content is NITF or XHTML XML markup or something similar, where the markup needs to be preserved for parsing by another software component. Note that the string is *not* guaranteed to be a well-formed XML document, since it may contain more than one top-level element.

Returns:
A string containing a logically-equivalent (*not* identical) XML document that can be passed to a parser for further processing.
See Also:
BaseNode.toXML(boolean), BaseNode.writeXML(java.io.Writer, boolean)