org.newsml.toolkit
Interface Catalog

All Superinterfaces:
BaseNode, HrefNode, IdNode

public interface Catalog
extends BaseNode, HrefNode, IdNode

Resource catalog.

The resource catalog declares vocabularies and other information that the rest of the document (or document subtree) can use. The NewsML Toolkit automatically resolves default schemes and vocabularies, so many client applications can safely ignore this interface.

Version:
2.0
Author:
Reuters PLC

Method Summary
 Catalog getReferencedCatalog(boolean useExternal)
          Retrieve the final catalog referenced.
 Resource[] getResource()
          Get an array of resources in this object.
 Resource getResource(int index)
          Get a single resource in a catalog.
 int getResourceCount()
          Count the resources in the catalog.
 TopicUse[] getTopicUse()
          Get all TopicUse children in an array.
 TopicUse getTopicUse(int index)
          Get topic use information from a catalog.
 int getTopicUseCount()
          Count the topic use elements in the catalog.
 
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.HrefNode
getHref
 
Methods inherited from interface org.newsml.toolkit.IdNode
getDuid, getEuid
 

Method Detail

getResourceCount

public int getResourceCount()
Count the resources in the catalog.
Returns:
The number of resources in the catalog.

getResource

public Resource getResource(int index)
Get a single resource in a catalog.
Parameters:
index - The index of the resource, zero-based, numbered sequentially in document order.
Returns:
The resource, or null if none was present with the specified index.

getResource

public Resource[] getResource()
Get an array of resources in this object.
Returns:
A (possibly-empty) array of resources

getTopicUseCount

public int getTopicUseCount()
Count the topic use elements in the catalog.
Returns:
The number of topic use elements.

getTopicUse

public TopicUse getTopicUse(int index)
Get topic use information from a catalog.
Parameters:
index - The index of the topic use element, zero-based, numbered sequentially in document order.
Returns:
The topic use information, or null if none was provided at the specified index.

getTopicUse

public TopicUse[] getTopicUse()
Get all TopicUse children in an array.
Returns:
A (possibly-empty) array of TopicUse children.

getReferencedCatalog

public Catalog getReferencedCatalog(boolean useExternal)
                             throws IOException
Retrieve the final catalog referenced.

Follow any Href attributes recursively to the final catalog referenced. If there is not an Href attribute, return a copy of this catalog. The useExternal parameter controls whether this method will follow links outside the current NewsML document.

If the reference has no fragment identifier, the root element of the document must be Catalog; otherwise, the fragment identifier must be the Duid of a Catalog element.

Parameters:
useExternal - If false, do not attempt to retrieve any referenced catalog from outside the current NewsML package.
Returns:
The catalog referenced by the href attribute, if available, or null otherwise.
Throws:
IOException - if the external catalog cannot be processed.
NewsMLException - if the external document is loaded successfully but the reference does not point to a Catalog.