Constructor and Description |
---|
XElement(String name)
Creates a new entry with given name.
|
Modifier and Type | Method and Description |
---|---|
XElement |
addAttribute(XAttribute attribute)
Adds a new attribute to this entry.
|
XElement |
addBoolean(String name,
boolean value)
Adds a new attribute to this entry.
|
XElement |
addByte(String name,
byte value)
Adds a new attribute to this entry.
|
XElement |
addByteArray(String name,
byte[] value)
Adds a new attribute to this entry.
|
XElement |
addChar(String name,
char value)
Adds a new attribute to this entry.
|
XElement |
addDouble(String name,
double value)
Adds a new attribute to this entry.
|
XElement |
addElement(String name)
Creates and adds a new element.
|
void |
addElement(XElement element)
Adds a new element to this element.
|
XElement |
addFloat(String name,
float value)
Adds a new attribute to this entry.
|
XElement |
addInt(String name,
int value)
Adds a new attribute to this entry.
|
XElement |
addLong(String name,
long value)
Adds a new attribute to this entry.
|
XElement |
addShort(String name,
short value)
Adds a new attribute to this entry.
|
XElement |
addString(String name,
String value)
Adds a new attribute to this entry.
|
boolean |
attributeExists(String name)
Tells whether the attribute
name exists. |
XAttribute[] |
attributes()
Gets all attributes of this entry.
|
XElement[] |
children()
Gets all children of this entry.
|
XElement |
copy()
Creates an independent copy of this container.
|
void |
copy(XElement original)
Makes a copy of all the elements of
original
and stores them in this container. |
XAttribute |
getAttribute(String name)
Searches an attribute with the given name.
|
boolean |
getBoolean(String name)
Gets the value of an attribute.
|
byte |
getByte(String name)
Gets the value of an attribute.
|
byte[] |
getByteArray(String name)
Gets the value of an attribute.
|
char |
getChar(String name)
Gets the value of an attribute.
|
double |
getDouble(String name)
Gets the value of an attribute.
|
XElement |
getElement(int index)
Gets the index'th child of this element.
|
XElement |
getElement(String name)
Gets the first element with the given name.
|
int |
getElementCount()
Gets the number of children this element has.
|
XElement[] |
getElements(String... names)
Searches all children which have one of the name
names . |
XElement[] |
getElements(String name)
Gets all children with a given name.
|
float |
getFloat(String name)
Gets the value of an attribute.
|
int |
getInt(String name)
Gets the value of an attribute.
|
long |
getLong(String name)
Gets the value of an attribute.
|
String |
getName()
Gets the name of this attribute.
|
short |
getShort(String name)
Gets the value of an attribute.
|
String |
getString()
Gets the value of this container as string.
|
String |
getString(String name)
Gets the value of an attribute.
|
Iterator<XElement> |
iterator() |
XAttribute |
removeAttribute(String name)
Removes the attribute with name
name from this XElement . |
boolean |
removeAttribute(XAttribute attribute)
Removes the attribute
attribute from this XElement . |
boolean |
removeElement(XElement element)
Removes the child
element from this XElement . |
void |
setName(String name)
Sets the name of this attribute.
|
void |
setString(String s)
Sets the value of this container.
|
String |
toString() |
copy, getBoolean, getByte, getByteArray, getChar, getDouble, getFloat, getInt, getLong, getShort, getValue, setBoolean, setByte, setByteArray, setChar, setDouble, setFloat, setInt, setLong, setShort, setValue
public XElement(String name)
name
- the name of this entrypublic XElement copy()
XContainer
copy
in class XContainer
public void copy(XElement original)
original
and stores them in this container.original
- the element to copypublic void setName(String name)
name
- the new namepublic String getName()
public XAttribute[] attributes()
public XElement[] children()
public XElement addAttribute(XAttribute attribute)
attribute
- the new attributethis
public XAttribute removeAttribute(String name)
name
from this XElement
.name
- the name of the attribute to removenull
if not foundpublic boolean removeAttribute(XAttribute attribute)
attribute
from this XElement
.attribute
- the attribute to removetrue
if attribute
was removedpublic XElement addByte(String name, byte value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addShort(String name, short value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addInt(String name, int value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addLong(String name, long value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addFloat(String name, float value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addDouble(String name, double value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addChar(String name, char value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addString(String name, String value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addBoolean(String name, boolean value)
name
- the name of the attributevalue
- the value of the attributethis
public XElement addByteArray(String name, byte[] value)
name
- the name of the attributevalue
- the value of the attributethis
public boolean attributeExists(String name)
name
exists.name
- the name to searchtrue
if such an attribute existspublic XAttribute getAttribute(String name)
name
- the name of the attributepublic byte getByte(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public short getShort(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public int getInt(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public long getLong(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public float getFloat(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public double getDouble(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public char getChar(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public String getString(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public boolean getBoolean(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public byte[] getByteArray(String name)
name
- the name of the attributeXException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public boolean removeElement(XElement element)
element
from this XElement
.element
- the element to removetrue
if element
was removed, false
otherwisepublic void addElement(XElement element)
element
- the new childpublic XElement addElement(String name)
name
- the name of the new elementpublic XElement getElement(String name)
name
- the name of the elementnull
public int getElementCount()
public XElement getElement(int index)
index
- the index of the childpublic XElement[] getElements(String name)
name
- the name each child must havepublic XElement[] getElements(String... names)
names
.names
- the names to searchpublic void setString(String s)
XContainer
setString
in class XContainer
s
- the valuepublic String getString()
XContainer
getString
in class XContainer