|
||||||||||
| 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>
Class description |
| Field Summary | |
|---|---|
protected Element.XMLIdentityHashMap<String,String> |
attributes
Field description |
protected LinkedList<XMLNodeIfc> |
children
Field description |
protected String |
defxmlns
Field description |
protected String |
name
Field description |
protected String |
xmlns
Field description |
| 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()
Method description |
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)
Deprecated. use findChild(java.lang.String[]) instead. |
Element |
findChild(String[] elemPath)
Method description |
Element |
findChildStaticStr(String[] elementPath)
Method description |
String |
getAttribute(String attName)
Deprecated. use getAttributeStaticStr(java.lang.String) instead. |
String |
getAttribute(String[] elementPath,
String att_name)
Deprecated. |
String |
getAttribute(String elementPath,
String att_name)
Deprecated. use getAttributeStaticStr(java.lang.String[], java.lang.String)
instead. |
Map<String,String> |
getAttributes()
Get the Attributes value. |
String |
getAttributeStaticStr(String attName)
Method description |
String |
getAttributeStaticStr(String[] elementPath,
String att_name)
Method description |
String |
getCData()
Gets the value of cdata |
String |
getCData(String elementPath)
Deprecated. use getCData(java.lang.String[]) instead. |
String |
getCData(String[] elementPath)
Method description |
String |
getCDataStaticStr(String[] elementPath)
Method description |
Element |
getChild(String name)
Method description |
Element |
getChild(String name,
String child_xmlns)
Method description |
String |
getChildAttribute(String childName,
String attName)
Deprecated. use getChildAttributeStaticStr(java.lang.String, java.lang.String) instead. |
String |
getChildAttributeStaticStr(String childName,
String attName)
Method description |
String |
getChildCData(String elementPath)
Deprecated. use getCData(java.lang.String[]) instead. |
String |
getChildCData(String[] elementPath)
Method description |
String |
getChildCDataStaticStr(String[] elementPath)
Method description |
List<Element> |
getChildren()
Method description |
List<Element> |
getChildren(String elementPath)
Deprecated. use getChildren(java.lang.String[]) instead. |
List<Element> |
getChildren(String[] elementPath)
Method description |
List<Element> |
getChildrenStaticStr(String[] elementPath)
Method description |
Element |
getChildStaticStr(String name)
Method description |
String |
getName()
Gets the value of name |
String |
getXMLNS()
|
String |
getXMLNS(String elementPath)
Deprecated. use getXMLNS(java.lang.String[]) instead. |
String |
getXMLNS(String[] elementPath)
Method description |
String |
getXMLNSStaticStr(String[] elementPath)
Method description |
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 |
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 |
setAttributeStaticStr(String[] elementPath,
String att_name,
String att_value)
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 findChildStaticStr(String[] elementPath)
elementPath -
public Element findChild(String[] elemPath)
elemPath -
@Deprecated public Element findChild(String elementPath)
findChild(java.lang.String[]) instead.
elementPath -
@Deprecated public String getAttribute(String attName)
getAttributeStaticStr(java.lang.String) instead.
attName -
@Deprecated
public String getChildAttribute(String childName,
String attName)
getChildAttributeStaticStr(java.lang.String, java.lang.String) instead.
childName - attName -
public String getChildAttributeStaticStr(String childName,
String attName)
childName - attName -
public String getAttributeStaticStr(String attName)
attName -
@Deprecated
public String getAttribute(String elementPath,
String att_name)
getAttributeStaticStr(java.lang.String[], java.lang.String)
instead.
elementPath - att_name -
@Deprecated
public String getAttribute(String[] elementPath,
String att_name)
elementPath - att_name -
getAttributeStaticStr(java.lang.String[], java.lang.String)
instead.
public String getAttributeStaticStr(String[] elementPath,
String att_name)
elementPath - att_name -
public Map<String,String> getAttributes()
@Deprecated public String getCData(String elementPath)
getCData(java.lang.String[]) instead.
elementPath -
public String getCData(String[] elementPath)
elementPath -
public String getCDataStaticStr(String[] elementPath)
elementPath -
public String getCData()
public Element getChild(String name)
name -
public Element getChildStaticStr(String name)
name -
public Element getChild(String name,
String child_xmlns)
name - child_xmlns -
@Deprecated public String getChildCData(String elementPath)
getCData(java.lang.String[]) instead.
elementPath -
public String getChildCData(String[] elementPath)
elementPath -
public String getChildCDataStaticStr(String[] elementPath)
elementPath -
public List<Element> getChildren()
@Deprecated public List<Element> getChildren(String elementPath)
getChildren(java.lang.String[]) instead.
elementPath -
public List<Element> getChildren(String[] elementPath)
elementPath -
public List<Element> getChildrenStaticStr(String[] elementPath)
elementPath -
public String getName()
public String getXMLNS()
@Deprecated public String getXMLNS(String elementPath)
getXMLNS(java.lang.String[]) instead.
elementPath -
public String getXMLNS(String[] elementPath)
elementPath -
public String getXMLNSStaticStr(String[] elementPath)
elementPath -
public int hashCode()
hashCode in class Objectpublic void removeAttribute(String key)
key - public boolean removeChild(Element child)
child -
public void setAttributeStaticStr(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 | |||||||||