|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object bibliothek.util.xml.XContainer bibliothek.util.xml.XElement
public class XElement
A XElement
is an entry in a xml-file. It has a name, can have children
and attributes, and might have a value.
Constructor Summary | |
---|---|
XElement(java.lang.String name)
Creates a new entry with given name. |
Method Summary | |
---|---|
XElement |
addAttribute(XAttribute attribute)
Adds a new attribute to this entry. |
XElement |
addBoolean(java.lang.String name,
boolean value)
Adds a new attribute to this entry. |
XElement |
addByte(java.lang.String name,
byte value)
Adds a new attribute to this entry. |
XElement |
addByteArray(java.lang.String name,
byte[] value)
Adds a new attribute to this entry. |
XElement |
addChar(java.lang.String name,
char value)
Adds a new attribute to this entry. |
XElement |
addDouble(java.lang.String name,
double value)
Adds a new attribute to this entry. |
XElement |
addElement(java.lang.String name)
Creates and adds a new element. |
void |
addElement(XElement element)
Adds a new element to this element. |
XElement |
addFloat(java.lang.String name,
float value)
Adds a new attribute to this entry. |
XElement |
addInt(java.lang.String name,
int value)
Adds a new attribute to this entry. |
XElement |
addLong(java.lang.String name,
long value)
Adds a new attribute to this entry. |
XElement |
addShort(java.lang.String name,
short value)
Adds a new attribute to this entry. |
XElement |
addString(java.lang.String name,
java.lang.String value)
Adds a new attribute to this entry. |
boolean |
attributeExists(java.lang.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(java.lang.String name)
Searches an attribute with the given name. |
boolean |
getBoolean(java.lang.String name)
Gets the value of an attribute. |
byte |
getByte(java.lang.String name)
Gets the value of an attribute. |
byte[] |
getByteArray(java.lang.String name)
Gets the value of an attribute. |
char |
getChar(java.lang.String name)
Gets the value of an attribute. |
double |
getDouble(java.lang.String name)
Gets the value of an attribute. |
XElement |
getElement(int index)
Gets the index'th child of this element. |
XElement |
getElement(java.lang.String name)
Gets the first element with the given name. |
int |
getElementCount()
Gets the number of children this element has. |
XElement[] |
getElements(java.lang.String... names)
Searches all children which have one of the name names . |
XElement[] |
getElements(java.lang.String name)
Gets all children with a given name. |
float |
getFloat(java.lang.String name)
Gets the value of an attribute. |
int |
getInt(java.lang.String name)
Gets the value of an attribute. |
long |
getLong(java.lang.String name)
Gets the value of an attribute. |
java.lang.String |
getName()
Gets the name of this attribute. |
short |
getShort(java.lang.String name)
Gets the value of an attribute. |
java.lang.String |
getString()
Gets the value of this container as string. |
java.lang.String |
getString(java.lang.String name)
Gets the value of an attribute. |
java.util.Iterator<XElement> |
iterator()
|
XAttribute |
removeAttribute(java.lang.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(java.lang.String name)
Sets the name of this attribute. |
void |
setString(java.lang.String s)
Sets the value of this container. |
java.lang.String |
toString()
|
Methods inherited from class bibliothek.util.xml.XContainer |
---|
copy, getBoolean, getByte, getByteArray, getChar, getDouble, getFloat, getInt, getLong, getShort, getValue, setBoolean, setByte, setByteArray, setChar, setDouble, setFloat, setInt, setLong, setShort, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public XElement(java.lang.String name)
name
- the name of this entryMethod Detail |
---|
public 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(java.lang.String name)
name
- the new namepublic java.lang.String getName()
public java.util.Iterator<XElement> iterator()
iterator
in interface java.lang.Iterable<XElement>
public XAttribute[] attributes()
public XElement[] children()
public XElement addAttribute(XAttribute attribute)
attribute
- the new attribute
this
public XAttribute removeAttribute(java.lang.String name)
name
from this XElement
.
name
- the name of the attribute to remove
null
if not foundpublic boolean removeAttribute(XAttribute attribute)
attribute
from this XElement
.
attribute
- the attribute to remove
true
if attribute
was removedpublic XElement addByte(java.lang.String name, byte value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addShort(java.lang.String name, short value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addInt(java.lang.String name, int value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addLong(java.lang.String name, long value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addFloat(java.lang.String name, float value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addDouble(java.lang.String name, double value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addChar(java.lang.String name, char value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addString(java.lang.String name, java.lang.String value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addBoolean(java.lang.String name, boolean value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addByteArray(java.lang.String name, byte[] value)
name
- the name of the attributevalue
- the value of the attribute
this
public boolean attributeExists(java.lang.String name)
name
exists.
name
- the name to search
true
if such an attribute existspublic XAttribute getAttribute(java.lang.String name)
name
- the name of the attribute
public byte getByte(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public short getShort(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public int getInt(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public long getLong(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public float getFloat(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public double getDouble(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public char getChar(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public java.lang.String getString(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public boolean getBoolean(java.lang.String name)
name
- the name of the attribute
XException
- if the attribute does not exist or if the value
is in the wrong formatgetAttribute(String)
public byte[] getByteArray(java.lang.String name)
name
- the name of the attribute
XException
- 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 remove
true
if element
was removed, false
otherwisepublic void addElement(XElement element)
element
- the new childpublic XElement addElement(java.lang.String name)
name
- the name of the new element
public XElement getElement(java.lang.String name)
name
- the name of the element
null
public int getElementCount()
public XElement getElement(int index)
index
- the index of the child
public XElement[] getElements(java.lang.String name)
name
- the name each child must have
public XElement[] getElements(java.lang.String... names)
names
.
names
- the names to search
public void setString(java.lang.String s)
XContainer
setString
in class XContainer
s
- the valuepublic java.lang.String getString()
XContainer
getString
in class XContainer
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |