Project JXTA

net.jxta.document
Interface Element

All Known Subinterfaces:
StructuredDocument, StructuredTextDocument, TextElement

public interface Element

This interface describes a StructuredDocument element. An element represents a portion of a StructuredDocument. An element is identifiable by a key and may optionally have a value. Each element also maintains a collection of references to other elements, its children. Elmenents can be composed into arbitrary hierarchical structures forming complex data structures. Element instances are always associated with a StructuredDocument. A StructuredDocument is a specialized form of element with additional features that make it appropriate for acting as the root of a hierarchy of elements.

Since:
Jxta 1.0
See Also:
Codat, Document, StructuredDocument, StructuredTextDocument

Method Summary
 void appendChild(Element element)
          Add a child element to this element.
 java.util.Enumeration getChildren()
          Returns an enumeration of the immediate children of this element
 java.util.Enumeration getChildren(java.lang.Object key)
          Returns an enumeration of the immediate children of this element whose name match the specified string.
 java.lang.Object getKey()
          Get the name associated with an element.
 Element getParent()
          Get the parent element of this element.
 java.lang.Object getValue()
          Get the value (if any) associated with an element.
 

Method Detail

getKey

public java.lang.Object getKey()
Get the name associated with an element.
Returns:
Object A string containing the key of this element.
Since:
JXTA 1.0

getValue

public java.lang.Object getValue()
Get the value (if any) associated with an element.
Returns:
Object A string containing the value of this element, if any, otherwise null.
Since:
JXTA 1.0

getParent

public Element getParent()
Get the parent element of this element. If the element has not been inserted into the Document then null is returned. If this element is the root of the Document then it returns itself.
Returns:
Element parent of this element
Since:
JXTA 1.0

appendChild

public void appendChild(Element element)
Add a child element to this element. The child element must be from the document as the element it is to be added to.
Parameters:
element - the element to be added as a child
Since:
JXTA 1.0

getChildren

public java.util.Enumeration getChildren()
Returns an enumeration of the immediate children of this element
Returns:
Enumeration An enumeration containing all of the children of this element.
Since:
JXTA 1.0

getChildren

public java.util.Enumeration getChildren(java.lang.Object key)
Returns an enumeration of the immediate children of this element whose name match the specified string.
Parameters:
key - The key which will be matched against.
Returns:
Enumeration enumeration containing all of the children of this element.
Since:
JXTA 1.0

Project JXTA