simple.util.xml
Interface Node


public interface Node

The Node object acts as a wrapper for a KDOM element that contains various convinience methods. In general this object is preferred to the org.kxml2.kdom.Element object for acquiring elements and text values.

The primary convinience offered by the Node object is the ability to acquire a transformed representation of eithier an element text block or attribute. This provides property getters which will transform "${property}" values with system properties.

Author:
Niall Gallagher
See Also:
PropertyBuffer

Method Summary
 java.lang.String getAttribute(java.lang.String name)
          This method is used to acquire an attribute from the wrapped element object.
 org.kxml2.kdom.Element getElement()
          This method is used to provide the source element that this object wraps.
 java.lang.String getName()
          This method is used to acquire the name of the element that this Node instance wraps.
 java.lang.String getProperty()
          This is used to acquire the transformed value of a text element.
 java.lang.String getProperty(java.lang.String name)
          This method is used to acquire a transformed value for the named attribute.
 java.lang.String getText()
          This is used to acquire the string value for the element text.
 boolean isElement()
          This method is used to determine the type of node this object represents.
 boolean isName(java.lang.String name)
          This is used to check for the name of the element that this node object wraps.
 

Method Detail

getElement

org.kxml2.kdom.Element getElement()
This method is used to provide the source element that this object wraps. This is provided so that should the traverser implementation wish to acquire details not provided by the Node object it can do so.

Returns:
this provides the source element that this wraps

getName

java.lang.String getName()
This method is used to acquire the name of the element that this Node instance wraps. This is used to that the traverser can determine how to handle the node object.

Returns:
this returns the name of the element this wraps

getAttribute

java.lang.String getAttribute(java.lang.String name)
This method is used to acquire an attribute from the wrapped element object. If the element does not exist within the node then this will return null, otherwise its string value.

Parameters:
name - this is the element attribute name to acquire
Returns:
this is the string value of the named attribute

getProperty

java.lang.String getProperty(java.lang.String name)
This method is used to acquire a transformed value for the named attribute. This will will acquire the named attribute and transform all occurances of "${property}" with its value from the set System properties.

Parameters:
name - this is the element attribute name to acquire
Returns:
this is the transformed value of the attribute

getProperty

java.lang.String getProperty()
This is used to acquire the transformed value of a text element. This will acquire the element block and transform all occurances of "${property}" with its value from the set System properties, or null if the text is null.

Returns:
this returns the transformed value of the text

getText

java.lang.String getText()
This is used to acquire the string value for the element text. If there is no text value within the element then this will return null. The getProperty can be used instead.

Returns:
this returns the raw string value for the text

isName

boolean isName(java.lang.String name)
This is used to check for the name of the element that this node object wraps. This is used by the traverser to determine what action is to be taken when processing the given node.

Parameters:
name - this is the name to be compared to the element
Returns:
this returns true if the element name matches

isElement

boolean isElement()
This method is used to determine the type of node this object represents. Typically an element is a usable XML element, however it can be a CDATA block or an XML comment block.

Returns:
this returns true if this is not an XML comment