eXchaNGeR

org.xngr
Interface XElement


public interface XElement

The interface that represents an XML element in the eXchaNGeR application. Use the factory method creatElement() to create a new element.

Version:
$Revision: 1.1.1.1 $, $Date: 2002/02/16 16:12:48 $
Author:
Edwin Dankert

Method Summary
 void add(XElement child)
          Adds a child element to this element.
 XDocument document()
          Returns the document for this element.
 String getAttribute(String name)
          Returns the value of the attribute with the name.
 String[][] getAttributes()
          Returns a 2 dimensional array of attributes.
 XElement getElement(String name)
          Returns the first element for the given name.
 XElement[] getElements()
          Returns all the child elements of this element.
 XElement[] getElements(String name)
          Returns all the child elements with a given name for this element.
 String getName()
          Returns the (local)name for this element.
 XElementType getType()
          Returns the type of this element.
 String getUniversalName()
          Returns the universal name for this element.
 String getValue()
          Gets the text value of this element.
 XUrl getXUrl()
          Returns the eXchaNGeR url of this element, This url consists of the document URL and the unique XPath expression to this element.
 boolean isRoot()
          A check wether this element is the root element.
 String namespace()
          Returns the namespace for this element.
 XElement parent()
          Returns the parent of this element.
 String path()
          Returns an XPath result, uniquely identifying this element.
 void putAttribute(String name, String value)
          Adds an attribute to the list of attributes or overwrites the attribute if the attribute name already exists.
 void remove(XElement child)
          Removes a child element from this element.
 void setValue(String value)
          Sets the text value of this element.
 

Method Detail

putAttribute

public void putAttribute(String name,
                         String value)
Adds an attribute to the list of attributes or overwrites the attribute if the attribute name already exists.
Parameters:
name - the name of the attribute.
value - the value of the attribute.

getAttributes

public String[][] getAttributes()
Returns a 2 dimensional array of attributes. where attribute[X][0] = name and where attribute[X][1] = value.
Returns:
a 2 dimesnional array of Strings.

getAttribute

public String getAttribute(String name)
Returns the value of the attribute with the name.
Parameters:
name - the name of the attribute.
Returns:
the attribute value.

getElement

public XElement getElement(String name)
Returns the first element for the given name.
Parameters:
name - the name of the element.
Returns:
the element.

getElements

public XElement[] getElements()
Returns all the child elements of this element.
Returns:
a list of elements.

getElements

public XElement[] getElements(String name)
Returns all the child elements with a given name for this element.
Parameters:
name - the name of the element.
Returns:
a list of elements.

namespace

public String namespace()
Returns the namespace for this element.
Returns:
a namespace representation.

getUniversalName

public String getUniversalName()
Returns the universal name for this element. The name is in the form: {namespace}localname
Returns:
a universal name representation.

getName

public String getName()
Returns the (local)name for this element.
Returns:
a name for the element.

isRoot

public boolean isRoot()
A check wether this element is the root element.
Returns:
true when the element is the root element.

parent

public XElement parent()
Returns the parent of this element.
Returns:
the parent element.

getValue

public String getValue()
Gets the text value of this element.
Returns:
the value of this element.

setValue

public void setValue(String value)
Sets the text value of this element.
Parameters:
value - the value of this element.

add

public void add(XElement child)
Adds a child element to this element.
Parameters:
child - the child element.

remove

public void remove(XElement child)
Removes a child element from this element.
Parameters:
child - the child element.

path

public String path()
Returns an XPath result, uniquely identifying this element.
Returns:
the XPath result identifying this element.

document

public XDocument document()
Returns the document for this element. Null if this element does not have a document associated.
Returns:
the document.

getType

public XElementType getType()
Returns the type of this element.
Returns:
the type.

getXUrl

public XUrl getXUrl()
Returns the eXchaNGeR url of this element, This url consists of the document URL and the unique XPath expression to this element. This method returns null if the element does not have an associated document.
Returns:
the xurl.

eXchaNGeR

Copyright © 2002, Cladonia Ltd., All Rights Reserved