|
||||||||||
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(String name)
Creates a new entry with given name. |
Method Summary | |
---|---|
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()
|
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(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(String name)
name
- the new namepublic String getName()
public Iterator<XElement> iterator()
iterator
in interface Iterable<XElement>
public XAttribute[] attributes()
public XElement[] children()
public XElement addAttribute(XAttribute attribute)
attribute
- the new attribute
this
public XAttribute removeAttribute(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(String name, byte value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addShort(String name, short value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addInt(String name, int value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addLong(String name, long value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addFloat(String name, float value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addDouble(String name, double value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addChar(String name, char value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addString(String name, String value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addBoolean(String name, boolean value)
name
- the name of the attributevalue
- the value of the attribute
this
public XElement addByteArray(String name, byte[] value)
name
- the name of the attributevalue
- the value of the attribute
this
public boolean attributeExists(String name)
name
exists.
name
- the name to search
true
if such an attribute existspublic XAttribute getAttribute(String name)
name
- the name of the attribute
public byte getByte(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(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(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(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(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(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(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 String getString(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(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(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(String name)
name
- the name of the new element
public XElement getElement(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(String name)
name
- the name each child must have
public XElement[] getElements(String... names)
names
.
names
- the names to search
public void setString(String s)
XContainer
setString
in class XContainer
s
- the valuepublic String getString()
XContainer
getString
in class XContainer
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |