at.woli.xml
Class XMLData

java.lang.Object
  extended by at.woli.xml.XMLData

public class XMLData
extends Object

XMLData to store all elements and attributes of an XML Object.

Version:
0.5.1
Author:
Wolfgang Nitzlnader

Field Summary
private  ArrayList<XMLDataElement> dataArray
          Stores all elements of the object
static int REMOVE_ALL
          Removes all elements, which were find in the List
NOT IMPLEMENTED YET
static int REMOVE_FIRST
          Removes the first element from the list
NOT IMPLEMENTED YET
static int REMOVE_LAST
          Removes the last element from the list
NOT IMPLEMENTED YET
private  String rootElementName
          The name of the root element
private  XMLDataElement xmlElement
          Actual element which is in use
 
Constructor Summary
XMLData()
          Standard constructor all variables are initialized with 0
XMLData(String rootElementName)
          Constructor which sets the name of the root element with the given parameter
XMLData(String rootElementName, String elementName, Object elementValue)
          Constructor which creates a new Element with the given parameters
 
Method Summary
 void addElementToArray(XMLDataElement xmlElement)
          Adds an element of type XMLDataElement to the list of elements
 void addNewAttributeToLastElement(String attributeName, String attributeValue)
          Adds a new attribute to the last element in the list
 void addNewElementToArray(String elementName, Object elementValue)
          Adds a new element to the list of elements
 ArrayList<XMLDataElement> getDataArray()
          Returns the list of elements
 XMLDataElement getElementAtIndex(int index)
          Returns an element from the list of elements at the given index
 XMLDataElement getElementByName(String name)
          Returns an element from the list of elements by the given name
 XMLDataElement getFirstElement()
          Returns the first element from the list of elements
 XMLDataElement getLastElement()
          Returns the last element from the list of elements
 int getNumbersOfElements()
          Returns the number of elements from the list of elements
 String getRootElementName()
          Returns the name of the root element
 XMLDataElement getXmlElement()
          Returns the actual element which is in use
 void removeElementFromArrayByIndex(int index)
          Removes an element at the given index
 void removeElementFromArrayByName(String name, int type)
          Removes an element with the given name
 void removeElementFromArrayByValue(String value, int type)
          Removes an element with the given value
 void setDataArray(ArrayList<XMLDataElement> dataArray)
          Sets the list of elements in this class
 void setRootElementName(String rootElementName)
          Sets the name of the root element
 void setXmlElement(XMLDataElement xmlElement)
          Setd the actual element of the class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REMOVE_ALL

public static final int REMOVE_ALL
Removes all elements, which were find in the List
NOT IMPLEMENTED YET

See Also:
Constant Field Values

REMOVE_FIRST

public static final int REMOVE_FIRST
Removes the first element from the list
NOT IMPLEMENTED YET

See Also:
Constant Field Values

REMOVE_LAST

public static final int REMOVE_LAST
Removes the last element from the list
NOT IMPLEMENTED YET

See Also:
Constant Field Values

rootElementName

private String rootElementName
The name of the root element


dataArray

private ArrayList<XMLDataElement> dataArray
Stores all elements of the object


xmlElement

private XMLDataElement xmlElement
Actual element which is in use

Constructor Detail

XMLData

public XMLData()
Standard constructor all variables are initialized with 0


XMLData

public XMLData(String rootElementName)
Constructor which sets the name of the root element with the given parameter

Parameters:
rootElementName - The Name of the root element

XMLData

public XMLData(String rootElementName,
               String elementName,
               Object elementValue)
Constructor which creates a new Element with the given parameters

Parameters:
rootElementName - The Name of the root element
elementName - The Name of the element
elementValue - The Value of the element
Method Detail

getDataArray

public ArrayList<XMLDataElement> getDataArray()
Returns the list of elements

Returns:
the list of elements

setDataArray

public void setDataArray(ArrayList<XMLDataElement> dataArray)
Sets the list of elements in this class

Parameters:
dataArray - The list of elements

getXmlElement

public XMLDataElement getXmlElement()
Returns the actual element which is in use

Returns:
the actual element

setXmlElement

public void setXmlElement(XMLDataElement xmlElement)
Setd the actual element of the class.

ATTENTION!!!!! This function do not add the element to the list of elements in the class.
If you want to add an element of type XMLElement to the list of elements, please use the function addElementToArray()

Parameters:
xmlElement - An element of the type XMLElement
See Also:
addElementToArray(XMLDataElement)

getRootElementName

public String getRootElementName()
Returns the name of the root element

Returns:
the name of the root element

getFirstElement

public XMLDataElement getFirstElement()
Returns the first element from the list of elements

Returns:
the frist element
See Also:
getElementAtIndex(int), getLastElement(), getElementByName(String)

getLastElement

public XMLDataElement getLastElement()
Returns the last element from the list of elements

Returns:
the last element
See Also:
getElementAtIndex(int), getFirstElement(), getElementByName(String)

getElementAtIndex

public XMLDataElement getElementAtIndex(int index)
Returns an element from the list of elements at the given index

Returns:
the an element from the given index
See Also:
getFirstElement(), getLastElement(), getElementByName(String)

getElementByName

public XMLDataElement getElementByName(String name)
Returns an element from the list of elements by the given name

Parameters:
name - The name of the element
Returns:
the an element from the given name or null, if no element was found
See Also:
getFirstElement(), getLastElement(), getElementAtIndex(int)

getNumbersOfElements

public int getNumbersOfElements()
Returns the number of elements from the list of elements

Returns:
the numbers elements

setRootElementName

public void setRootElementName(String rootElementName)
Sets the name of the root element

Parameters:
rootElementName - The name of the root element

removeElementFromArrayByIndex

public void removeElementFromArrayByIndex(int index)
Removes an element at the given index

Parameters:
index - The index of an element, which will be removed

removeElementFromArrayByName

public void removeElementFromArrayByName(String name,
                                         int type)
Removes an element with the given name

Parameters:
name - The name of an element, which will be removed
type - This is just a placeholder for features in later releases

removeElementFromArrayByValue

public void removeElementFromArrayByValue(String value,
                                          int type)
Removes an element with the given value

Parameters:
value - The value of an element, which will be removed
type - This is just a placeholder for features in later releases

addElementToArray

public void addElementToArray(XMLDataElement xmlElement)
Adds an element of type XMLDataElement to the list of elements

Parameters:
xmlElement - The element which will be add to the list of elements

addNewElementToArray

public void addNewElementToArray(String elementName,
                                 Object elementValue)
Adds a new element to the list of elements

Parameters:
elementName - The name of the new element
elementValue - The value of the new element

addNewAttributeToLastElement

public void addNewAttributeToLastElement(String attributeName,
                                         String attributeValue)
Adds a new attribute to the last element in the list

Parameters:
attributeName - The name of the new attribute
attributeValue - The value of the new attribute