com.starteam.xml
Class XMLElement

java.lang.Object
  extended by com.starteam.xml.XMLElement

public final class XMLElement
extends java.lang.Object

An element in an XML document.

See Also:
XMLDocument.getRootElement()

Method Summary
 XMLAttribute[] getAttributes()
          Gets the list of attributes associated with this element, in no particular order.
 java.lang.String getAttributeValue(java.lang.String name)
          Gets the value of the attribute with the given name (and that does not belong to a namespace).
 XMLElement getChild(java.lang.String name)
          Gets the first child element nested directly within this element that has the given name (and does not belong to a namespace).
 XMLElement[] getChildren()
          Gets a list of all the child elements nested directly (that is, one level deep) within this element.
 XMLElement[] getChildren(java.lang.String name)
          Gets a list of all the child elements nested directly (that is, one level deep) within this element whose names match the given name (and that do not belong to a namespace).
 java.lang.String getName()
          Gets the local name of this element (that is, without a namespace prefix).
 java.lang.String getQualifiedName()
          Gets the qualified name of this element, in the form [namespace]:[name].
 java.lang.String getText()
          Gets the textual content directly held under this element.
 void removeChild(XMLElement node)
          Remove a child element from this collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getName

public java.lang.String getName()
Gets the local name of this element (that is, without a namespace prefix).

Returns:
The local name of this element.

getQualifiedName

public java.lang.String getQualifiedName()
Gets the qualified name of this element, in the form [namespace]:[name]. If this element does not belong to a namespace, then the qualified name is the same as the local name.

Returns:
The qualified name of this element.

getChildren

public XMLElement[] getChildren()
Gets a list of all the child elements nested directly (that is, one level deep) within this element. If this element has no child elements, an empty list is returned.

Returns:
A list of all the direct child elements of this element.

getChildren

public XMLElement[] getChildren(java.lang.String name)
Gets a list of all the child elements nested directly (that is, one level deep) within this element whose names match the given name (and that do not belong to a namespace). If this element has no such child elements, an empty list is returned.

Parameters:
name - The element name.
Returns:
A list of all the direct child elements with the given name.

getChild

public XMLElement getChild(java.lang.String name)
Gets the first child element nested directly within this element that has the given name (and does not belong to a namespace). If this element has no such children, then null is returned.

Parameters:
name - the name to look for
Returns:
The first child element with the given name, or null.

removeChild

public void removeChild(XMLElement node)
Remove a child element from this collection. Useful for applications that need to process large DOMs, but maintain a constant amount of memory This operation affects the SDK representation of the DOM alone It does not affect the underlying w3c XML Document nodes, if the DOM has been preserved. Once (at least one) element has been removed, the underlying XML representation no longer resembles the original DOM loaded from the File or Stream

Parameters:
node - XMLElement the child element to be removed

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String name)
Gets the value of the attribute with the given name (and that does not belong to a namespace). If this element has no such attribute, then null is returned.

Parameters:
name - The attribute name.
Returns:
The value of the attribute, or null.

getAttributes

public XMLAttribute[] getAttributes()
Gets the list of attributes associated with this element, in no particular order.

Returns:
The attributes associated with this element, or an empty array if there are none.

getText

public java.lang.String getText()
Gets the textual content directly held under this element. This includes all text within this single element, including whitespace and CDATA sections if they exist. It's essentially the concatenation of all Text and CDATA nodes contained in this element. The call does not recurse into child elements. If no text exists within this element, an empty string is returned.

Returns:
The textual content of this element.


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.