tigase.xml
Class Element

java.lang.Object
  extended by tigase.xml.Element
All Implemented Interfaces:
Cloneable, Comparable<Element>, XMLNodeIfc<Element>
Direct Known Subclasses:
DBElement

@TODO(note="Make it a bit lighter.")
public class Element
extends Object
implements XMLNodeIfc<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:

Created: Mon Oct 4 17:55:16 2004

Version:
$Rev$
Author:
Artur Hefczyc

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

attributes

protected Element.XMLIdentityHashMap<String,String> attributes
Field description


children

protected LinkedList<XMLNodeIfc> children
Field description


defxmlns

protected String defxmlns
Field description


name

protected String name
Field description


xmlns

protected String xmlns
Field description

Constructor Detail

Element

public Element(Element element)
Constructs ...

Parameters:
element -

Element

public Element(String argName)
Constructs ...

Parameters:
argName -

Element

public Element(String argName,
               String argCData)
Constructs ...

Parameters:
argName -
argCData -

Element

public Element(String argName,
               String[] att_names,
               String[] att_values)
Constructs ...

Parameters:
argName -
att_names -
att_values -

Element

public Element(String argName,
               Element[] children,
               String[] att_names,
               String[] att_values)
Constructs ...

Parameters:
argName -
children -
att_names -
att_values -

Element

public Element(String argName,
               String argCData,
               String[] att_names,
               String[] att_values)
Constructs ...

Parameters:
argName -
argCData -
att_names -
att_values -

Element

public Element(String argName,
               String argCData,
               StringBuilder[] att_names,
               StringBuilder[] att_values)
Constructs ...

Parameters:
argName -
argCData -
att_names -
att_values -
Method Detail

main

public static void main(String[] args)
                 throws Exception
Method description

Parameters:
args -
Throws:
Exception

addAttribute

public void addAttribute(String attName,
                         String attValue)
Method description

Parameters:
attName -
attValue -

addAttributes

public void addAttributes(Map<String,String> attrs)
Method description

Parameters:
attrs -

addChild

public void addChild(XMLNodeIfc child)
Method description

Parameters:
child -

addChildren

public void addChildren(List<Element> children)
Method description

Parameters:
children -

childrenToString

public String childrenToString()
Method description

Returns:

childrenToStringSecure

public String childrenToStringSecure()
Method description

Returns:

clone

public Element clone()
Method description

Specified by:
clone in interface XMLNodeIfc<Element>
Overrides:
clone in class Object
Returns:

compareTo

public int compareTo(Element elem)
Method compareTo is used to perform

Specified by:
compareTo in interface Comparable<Element>
Parameters:
elem - an Object value
Returns:
an int value

equals

public boolean equals(Object obj)
Method description

Overrides:
equals in class Object
Parameters:
obj -
Returns:

findChildStaticStr

public Element findChildStaticStr(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

findChild

public Element findChild(String[] elemPath)
Method description

Parameters:
elemPath -
Returns:

findChild

@Deprecated
public Element findChild(String elementPath)
Deprecated. use findChild(java.lang.String[]) instead.

Method description

Parameters:
elementPath -
Returns:

getAttribute

@Deprecated
public String getAttribute(String attName)
Deprecated. use getAttributeStaticStr(java.lang.String) instead.

Method description

Parameters:
attName -
Returns:

getChildAttribute

@Deprecated
public String getChildAttribute(String childName,
                                           String attName)
Deprecated. use getChildAttributeStaticStr(java.lang.String, java.lang.String) instead.

Method description

Parameters:
childName -
attName -
Returns:

getChildAttributeStaticStr

public String getChildAttributeStaticStr(String childName,
                                         String attName)
Method description

Parameters:
childName -
attName -
Returns:

getAttributeStaticStr

public String getAttributeStaticStr(String attName)
Method description

Parameters:
attName -
Returns:

getAttribute

@Deprecated
public String getAttribute(String elementPath,
                                      String att_name)
Deprecated. use getAttributeStaticStr(java.lang.String[], java.lang.String) instead.

Method description

Parameters:
elementPath -
att_name -
Returns:

getAttribute

@Deprecated
public String getAttribute(String[] elementPath,
                                      String att_name)
Deprecated. 

Method description

Parameters:
elementPath -
att_name -
Returns:
getAttributeStaticStr(java.lang.String[], java.lang.String) instead.

getAttributeStaticStr

public String getAttributeStaticStr(String[] elementPath,
                                    String att_name)
Method description

Parameters:
elementPath -
att_name -
Returns:

getAttributes

public Map<String,String> getAttributes()
Get the Attributes value.

Returns:
the Attributes value.

getCData

@Deprecated
public String getCData(String elementPath)
Deprecated. use getCData(java.lang.String[]) instead.

Method description

Parameters:
elementPath -
Returns:

getCData

public String getCData(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

getCDataStaticStr

public String getCDataStaticStr(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

getCData

public String getCData()
Gets the value of cdata

Returns:
the value of cdata

getChild

public Element getChild(String name)
Method description

Parameters:
name -
Returns:

getChildStaticStr

public Element getChildStaticStr(String name)
Method description

Parameters:
name -
Returns:

getChild

public Element getChild(String name,
                        String child_xmlns)
Method description

Parameters:
name -
child_xmlns -
Returns:

getChildCData

@Deprecated
public String getChildCData(String elementPath)
Deprecated. use getCData(java.lang.String[]) instead.

Method description

Parameters:
elementPath -
Returns:

getChildCData

public String getChildCData(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

getChildCDataStaticStr

public String getChildCDataStaticStr(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

getChildren

public List<Element> getChildren()
Method description

Returns:

getChildren

@Deprecated
public List<Element> getChildren(String elementPath)
Deprecated. use getChildren(java.lang.String[]) instead.

Method description

Parameters:
elementPath -
Returns:

getChildren

public List<Element> getChildren(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

getChildrenStaticStr

public List<Element> getChildrenStaticStr(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

getName

public String getName()
Gets the value of name

Returns:
the value of name

getXMLNS

public String getXMLNS()
Returns:

getXMLNS

@Deprecated
public String getXMLNS(String elementPath)
Deprecated. use getXMLNS(java.lang.String[]) instead.

Parameters:
elementPath -
Returns:

getXMLNS

public String getXMLNS(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

getXMLNSStaticStr

public String getXMLNSStaticStr(String[] elementPath)
Method description

Parameters:
elementPath -
Returns:

hashCode

public int hashCode()
Method description

Overrides:
hashCode in class Object
Returns:

removeAttribute

public void removeAttribute(String key)
Method description

Parameters:
key -

removeChild

public boolean removeChild(Element child)
Method description

Parameters:
child -
Returns:

setAttributeStaticStr

public void setAttributeStaticStr(String[] elementPath,
                                  String att_name,
                                  String att_value)
Method description

Parameters:
elementPath -
att_name -
att_value -

setAttribute

public void setAttribute(String key,
                         String value)
Method description

Parameters:
key -
value -

setAttributes

public void setAttributes(Map<String,String> newAttributes)
Set the Attributes value.

Parameters:
newAttributes - The new Attributes value.

setAttributes

public void setAttributes(StringBuilder[] names,
                          StringBuilder[] values)
Method description

Parameters:
names -
values -

setAttributes

public void setAttributes(String[] names,
                          String[] values)
Method description

Parameters:
names -
values -

setCData

public void setCData(String argCData)
Sets the value of cdata

Parameters:
argCData - Value to assign to this.cdata

setChildren

public void setChildren(List<XMLNodeIfc> children)
Method description

Parameters:
children -

setDefXMLNS

public void setDefXMLNS(String ns)
Method description

Parameters:
ns -

setName

public void setName(String argName)
Sets the value of name

Parameters:
argName - Value to assign to this.name

setXMLNS

public void setXMLNS(String ns)
Method description

Parameters:
ns -

toString

public String toString()
Method description

Overrides:
toString in class Object
Returns:

toStringNoChildren

public String toStringNoChildren()
Method description

Returns:

toStringSecure

public String toStringSecure()
Method description

Specified by:
toStringSecure in interface XMLNodeIfc<Element>
Returns:

cdataToString

protected String cdataToString()
Method description

Returns:


Copyright © 2013 Tigase. All Rights Reserved.