org.apache.felix.ipojo.metadata
Class Element

java.lang.Object
  extended by org.apache.felix.ipojo.metadata.Element

public class Element
extends java.lang.Object

Element.

Author:
Felix Project Team

Constructor Summary
Element(java.lang.String name, java.lang.String ns)
          Constructor.
 
Method Summary
 void addAttribute(Attribute att)
          Add a attribute.
 void addElement(Element elem)
          Add a sub-element.
 boolean containsAttribute(java.lang.String name)
          Is the element contains an attribute of the name given in parameter.
 boolean containsElement(java.lang.String name)
          Is the element contains a sub-element of the type given in parameter.
 boolean containsElement(java.lang.String name, java.lang.String ns)
          Is the element contains a sub-element of the type given in parameter.
 java.lang.String getAttribute(java.lang.String name)
          Return the value of the attribute given in parameter.
 java.lang.String getAttribute(java.lang.String name, java.lang.String ns)
          Return the value of the attribute "name" of the namespace "ns".
 Attribute[] getAttributes()
          Get element attributes.
 Element[] getElements()
          Get sub-elements.
 Element[] getElements(java.lang.String name)
          Get the elements array of the element type given in parameter.
 Element[] getElements(java.lang.String name, java.lang.String ns)
          Get the elements array of the element type given in parameter.
 java.lang.String getName()
          Get element name.
 java.lang.String getNameSpace()
          Get element namespace.
 void removeAttribute(Attribute att)
          Remove an attribute.
 void removeElement(Element elem)
          Remove a sub-element.
 java.lang.String toString()
          To String method.
 java.lang.String toXMLString()
          Get the XML form of this element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Element

public Element(java.lang.String name,
               java.lang.String ns)
Constructor.

Parameters:
name - : the name of the element
ns - : the namespace of the element
Method Detail

getElements

public Element[] getElements()
Get sub-elements.

Returns:
the sub elements

getAttributes

public Attribute[] getAttributes()
Get element attributes.

Returns:
the attributes

getName

public java.lang.String getName()
Get element name.

Returns:
the name of the element

getNameSpace

public java.lang.String getNameSpace()
Get element namespace.

Returns:
the namespace of the element

getAttribute

public java.lang.String getAttribute(java.lang.String name)
Return the value of the attribute given in parameter.

Parameters:
name - : the name of the searched attribute
Returns:
the value of the attribute given in parameter, null if the attribute does not exist

getAttribute

public java.lang.String getAttribute(java.lang.String name,
                                     java.lang.String ns)
Return the value of the attribute "name" of the namespace "ns".

Parameters:
name - : name of the attribute to find
ns - : namespace of the attribute to find
Returns:
the String value of the attribute, or null if the attribute is not found.

addElement

public void addElement(Element elem)
Add a sub-element.

Parameters:
elem - : the element to add

removeElement

public void removeElement(Element elem)
Remove a sub-element.

Parameters:
elem - : the element to remove

addAttribute

public void addAttribute(Attribute att)
Add a attribute.

Parameters:
att - : the attribute to add

removeAttribute

public void removeAttribute(Attribute att)
Remove an attribute.

Parameters:
att - : the attribute to remove

getElements

public Element[] getElements(java.lang.String name)
Get the elements array of the element type given in parameter. This method look for an empty namespace.

Parameters:
name - : the type of the element to find (element name)
Returns:
the resulting element array (null if the search failed)

getElements

public Element[] getElements(java.lang.String name,
                             java.lang.String ns)
Get the elements array of the element type given in parameter.

Parameters:
name - : the type of the element to find (element name)
ns - : the namespace of the element
Returns:
the resulting element array (null if the search failed)

containsElement

public boolean containsElement(java.lang.String name)
Is the element contains a sub-element of the type given in parameter.

Parameters:
name - : type of the element to check.
Returns:
true if the element contains an element of the type "name"

containsElement

public boolean containsElement(java.lang.String name,
                               java.lang.String ns)
Is the element contains a sub-element of the type given in parameter.

Parameters:
name - : type of the element to check.
ns - : the namespace of the element to check.
Returns:
true if the element contains an element of the type "name"

containsAttribute

public boolean containsAttribute(java.lang.String name)
Is the element contains an attribute of the name given in parameter.

Parameters:
name - : name of the element
Returns:
true if the element contains an attribute of the type "name"

toXMLString

public java.lang.String toXMLString()
Get the XML form of this element.

Returns:
the XML snippet representing this element.

toString

public java.lang.String toString()
To String method.

Overrides:
toString in class java.lang.Object
Returns:
the String form of this element.
See Also:
Object.toString()