|
IMSEVimse 1.0 Draft |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--se.kth.cid.xml.XmlElement
This class represents a node in a very simplified DOM tree. The documents this class represents are subject to a number of constraints: 1. An element cannot have mixed CDATA and sub-elements. All CDATA will be concatenated. 2. The order of elements is preserved amongst elements with the same name. However, no order is preserved between elements of different names.
Constructor Summary | |
XmlElement(String nname)
Constructs an XmlElement with the given name. |
|
XmlElement(String nname,
String[] subElements)
Constructs an XmlElement with the given name and known sub-element names. |
Method Summary | |
void |
addCDATA(String ncdata)
Adds CDATA to this element. |
void |
addSubElement(XmlElement el)
Adds a sub-element to this element. |
String |
getAttribute(String attr)
Returns the value of the attribute with the given name. |
String[] |
getAttributes()
Returns the attribute names of this element. |
String |
getCDATA()
Returns the CDATA of this element. |
String |
getName()
Returns the name of this element. |
XmlElement |
getParent()
Returns the parent of this element. |
String[] |
getSubElementNames()
Returns the names of all sub-elements. |
int |
getSubElementNumber()
|
XmlElement[] |
getSubElements(String elname)
Returns all sub-elements with the given name. |
void |
removeSubElement(XmlElement el)
Removes the specified sub-element from this element. |
void |
setAttribute(String attribute,
String value)
Sets the given attribute to the given value. |
void |
setCDATA(String ncdata)
Sets the CDATA of this element. |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public XmlElement(String nname)
nname
- the name of this XmlElement.public XmlElement(String nname, String[] subElements)
nname
- the name of this XmlElement.subElements
- the names of the allowed sub-elements.Method Detail |
public XmlElement getParent()
public String getName()
public String getCDATA()
public void setCDATA(String ncdata)
ncdata
- the CDATA of this element.HasSubElementsException
- if this element already has sub-elements.public void addCDATA(String ncdata)
ncdata
- the additional CDATA of this element.public String[] getSubElementNames()
public int getSubElementNumber()
public XmlElement[] getSubElements(String elname)
elname
- the name of the elements wanted.public void addSubElement(XmlElement el) throws UnknownElementNameException
el
- the element to add.public void removeSubElement(XmlElement el)
el
- the sub-element to remove.public String[] getAttributes()
public String getAttribute(String attr)
attr
- the attribute of interest.public void setAttribute(String attribute, String value)
attribute
- the attribute to modify.value
- the value of the attribute, or null if the attribute should be removed.public String toString()
toString
in class Object
|
IMSEVimse 1.0 Draft |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |