|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecttigase.xml.Element
@TODO(note="Make it a bit lighter.") public class Element
Element - basic document tree node implementation. Supports Java
5.0 generic feature to make it easier to extend this class and still preserve
some useful functionality. Sufficient for simple cases but probably in the
most more advanced cases should be extended with additional features. Look in
API documentation for more details and information about existing extensions.
The most important features apart from abvious tree implementation are:
toString() implementation so it can generate valid
XML content from this element and all children.addChild(...), getChild(childName) supporting
generic types.findChild(childPath) finding child in subtree by given path
to element.getChildCData(childPath), getAttribute(childPath,
attName) returning element CData from child in subtree by given
path to element.Created: Mon Oct 4 17:55:16 2004
| Nested Class Summary | |
|---|---|
protected class |
Element.XMLIdentityHashMap<K,V>
|
| Field Summary | |
|---|---|
protected Element.XMLIdentityHashMap<String,String> |
attributes
|
protected LinkedList<XMLNodeIfc> |
children
|
protected String |
defxmlns
|
protected String |
name
|
protected String |
xmlns
|
| Constructor Summary | |
|---|---|
Element(Element element)
Constructs ... |
|
Element(String argName)
Constructs ... |
|
Element(String argName,
Element[] children,
String[] att_names,
String[] att_values)
Constructs ... |
|
Element(String argName,
String argCData)
Constructs ... |
|
Element(String argName,
String[] att_names,
String[] att_values)
Constructs ... |
|
Element(String argName,
String argCData,
String[] att_names,
String[] att_values)
Constructs ... |
|
Element(String argName,
String argCData,
StringBuilder[] att_names,
StringBuilder[] att_values)
Constructs ... |
|
| Method Summary | |
|---|---|
void |
addAttribute(String attName,
String attValue)
Method description |
void |
addAttributes(Map<String,String> attrs)
Method description |
void |
addChild(XMLNodeIfc child)
Method description |
void |
addChildren(List<Element> children)
Method description |
protected String |
cdataToString()
|
String |
childrenToString()
Method description |
String |
childrenToStringSecure()
Method description |
Element |
clone()
Method description |
int |
compareTo(Element elem)
Method compareTo is used to perform |
boolean |
equals(Object obj)
Method description |
Element |
findChild(String elementPath)
Method description |
String |
getAttribute(String attName)
Method description |
String |
getAttribute(String elementPath,
String att_name)
Method description |
String |
getAttributeFast(String attName)
|
Map<String,String> |
getAttributes()
Get the Attributes value. |
String |
getCData()
Gets the value of cdata |
String |
getCData(String elementPath)
Method description |
Element |
getChild(String name)
Method description |
Element |
getChild(String name,
String child_xmlns)
Method description |
String |
getChildCData(String elementPath)
Method description |
List<Element> |
getChildren()
Method description |
List<Element> |
getChildren(String elementPath)
Method description |
String |
getName()
Gets the value of name |
String |
getXMLNS()
|
String |
getXMLNS(String elementPath)
|
int |
hashCode()
Method description |
static void |
main(String[] args)
Method description |
void |
removeAttribute(String key)
Method description |
boolean |
removeChild(Element child)
Method description |
void |
setAttribute(String key,
String value)
Method description |
void |
setAttribute(String elementPath,
String att_name,
String att_value)
Method description |
void |
setAttributes(Map<String,String> newAttributes)
Set the Attributes value. |
void |
setAttributes(String[] names,
String[] values)
Method description |
void |
setAttributes(StringBuilder[] names,
StringBuilder[] values)
Method description |
void |
setCData(String argCData)
Sets the value of cdata |
void |
setChildren(List<XMLNodeIfc> children)
Method description |
void |
setDefXMLNS(String ns)
Method description |
void |
setName(String argName)
Sets the value of name |
void |
setXMLNS(String ns)
Method description |
String |
toString()
Method description |
String |
toStringNoChildren()
Method description |
String |
toStringSecure()
Method description |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Element.XMLIdentityHashMap<String,String> attributes
protected LinkedList<XMLNodeIfc> children
protected String defxmlns
protected String name
protected String xmlns
| Constructor Detail |
|---|
public Element(Element element)
element - public Element(String argName)
argName -
public Element(String argName,
String argCData)
argName - argCData -
public Element(String argName,
String[] att_names,
String[] att_values)
argName - att_names - att_values -
public Element(String argName,
Element[] children,
String[] att_names,
String[] att_values)
argName - children - att_names - att_values -
public Element(String argName,
String argCData,
String[] att_names,
String[] att_values)
argName - argCData - att_names - att_values -
public Element(String argName,
String argCData,
StringBuilder[] att_names,
StringBuilder[] att_values)
argName - argCData - att_names - att_values - | Method Detail |
|---|
public static void main(String[] args)
throws Exception
args -
Exception
public void addAttribute(String attName,
String attValue)
attName - attValue - public void addAttributes(Map<String,String> attrs)
attrs - public void addChild(XMLNodeIfc child)
child - public void addChildren(List<Element> children)
children - public String childrenToString()
public String childrenToStringSecure()
public Element clone()
clone in interface XMLNodeIfc<Element>clone in class Objectpublic int compareTo(Element elem)
compareTo is used to perform
compareTo in interface Comparable<Element>elem - an Object value
int valuepublic boolean equals(Object obj)
equals in class Objectobj -
public Element findChild(String elementPath)
elementPath -
public String getAttribute(String attName)
attName -
public String getAttributeFast(String attName)
public String getAttribute(String elementPath,
String att_name)
elementPath - att_name -
public Map<String,String> getAttributes()
public String getCData(String elementPath)
elementPath -
public String getCData()
public Element getChild(String name)
name -
public Element getChild(String name,
String child_xmlns)
name - child_xmlns -
public String getChildCData(String elementPath)
elementPath -
public List<Element> getChildren()
public List<Element> getChildren(String elementPath)
elementPath -
public String getName()
public String getXMLNS()
public String getXMLNS(String elementPath)
elementPath -
public int hashCode()
hashCode in class Objectpublic void removeAttribute(String key)
key - public boolean removeChild(Element child)
child -
public void setAttribute(String elementPath,
String att_name,
String att_value)
elementPath - att_name - att_value -
public void setAttribute(String key,
String value)
key - value - public void setAttributes(Map<String,String> newAttributes)
newAttributes - The new Attributes value.
public void setAttributes(StringBuilder[] names,
StringBuilder[] values)
names - values -
public void setAttributes(String[] names,
String[] values)
names - values - public void setCData(String argCData)
argCData - Value to assign to this.cdatapublic void setChildren(List<XMLNodeIfc> children)
children - public void setDefXMLNS(String ns)
ns - public void setName(String argName)
argName - Value to assign to this.namepublic void setXMLNS(String ns)
ns - public String toString()
toString in class Objectpublic String toStringNoChildren()
public String toStringSecure()
toStringSecure in interface XMLNodeIfc<Element>protected String cdataToString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||