public class Element extends Object
Attribute
objects
and sub-elements. This class is used to parse iPOJO metadata.Constructor and Description |
---|
Element(String name,
String ns)
Creates an Element.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(Attribute att)
Adds a attribute.
|
void |
addElement(Element elem)
Adds a sub-element.
|
boolean |
containsAttribute(String name)
Does the element contain an attribute of the name given in parameter.
|
boolean |
containsElement(String name)
Does the element contain a sub-element of the type given in parameter.
|
boolean |
containsElement(String name,
String ns)
Does the element contain a sub-element of the type given in parameter.
|
String |
getAttribute(String name)
Returns the value of the attribute given in parameter.
|
String |
getAttribute(String name,
String ns)
Returns the value of the attribute "name" of the namespace "ns".
|
Attribute[] |
getAttributes()
Gets element attributes.
|
Element[] |
getElements()
Gets sub-elements.
|
Element[] |
getElements(String name)
Gets the elements array of the element type given in parameter.
|
Element[] |
getElements(String name,
String ns)
Gets the elements array of the element type given in parameter.
|
String |
getName()
Gets element name.
|
String |
getNameSpace()
Gets element namespace.
|
void |
removeAttribute(Attribute att)
Removes an attribute.
|
void |
removeElement(Element elem)
Removes a sub-element.
|
String |
toString()
To String method.
|
String |
toXMLString()
Gets the XML form of this element.
|
public Element[] getElements()
public Attribute[] getAttributes()
public String getName()
public String getNameSpace()
public String getAttribute(String name)
name
- the name of the searched attributenull
if the attribute does not existpublic String getAttribute(String name, String ns)
name
- the name of the attribute to findns
- the namespace of the attribute to findnull
if the attribute is not found.public void addElement(Element elem)
elem
- the element to addpublic void removeElement(Element elem)
elem
- the element to removepublic void addAttribute(Attribute att)
att
- the attribute to addpublic void removeAttribute(Attribute att)
att
- the attribute to removepublic Element[] getElements(String name)
name
- the type of the element to find (element name)null
if the search failed)public Element[] getElements(String name, String ns)
name
- the type of the element to find (element name)ns
- the namespace of the elementnull
if the search failed)public boolean containsElement(String name)
name
- the type of the element to check.true
if the element contains an element of the type "name"public boolean containsElement(String name, String ns)
name
- the type of the element to check.ns
- the namespace of the element to check.true
if the element contains an element of the type "name"public boolean containsAttribute(String name)
name
- the name of the elementtrue
if the element contains an attribute of the type "name"public String toXMLString()
public String toString()
toString
in class Object
Object.toString()
Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.