Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

skElement Class Reference

This class represents an Element within an XML document. More...

#include <skElement.h>

Inheritance diagram for skElement:

skNode List of all members.

Public Member Functions

 skElement (const skString &tagname)
 This constructs a new element with the given tag.

virtual ~skElement ()
 Virtual destructor.

void appendChild (skNode *child)
 This adds a child to the list of children owned by this element.

void removeAndDestroyChild (skNode *child)
 This removes a child from the list of children owned by this element.

void removeChild (skNode *child)
 This removes a child from the list of children owned by this element.

void setAttribute (const skString &name, const skString &value)
 This sets an attribute of this element.

bool removeAttribute (const skString &name)
 This removes an attribute from the element.

skString getAttribute (const skString &name) const
 This returns the value of an attribute.

skString getAttribute (const skString &name, const skString &default_value) const
 This returns the value of an attribute.

skAttributeListgetAttributes ()
 This method returns the list of attributes owned by this element.

skNodeListgetChildNodes ()
 This method returns the list of child nodes owned by this element.

skString getTagName () const
 This returns the tag name for the element.

virtual NodeType getNodeType () const
 this returns the type of this node

virtual skNodeclone ()
 This method returns a new element with the same tag name, attributes and child list.

virtual skString toString () const
 Copies this element, its attributes and children to a string.

virtual void write (skOutputDestination &out) const
 Writes this element, its attributes and children to the given destination.

bool operator== (const skElement &other) const
 Does a deep comparison against another element, without checking the tag name of this element.

bool equals (const skNode &other) const
 Does a deep comparison against another element.

bool deepCompare (const skElement &other, bool check_tagname) const
 Does a deep compare another element, with an optional check on the tag name.


Protected Attributes

skString m_TagName
 this variable stores the tag name for this element

skAttributeList m_Attributes
 this holds the list of attributes for this element

skNodeList m_ChildNodes
 this holds the list of child nodes owned by this element


Detailed Description

This class represents an Element within an XML document.

The class forms part of the Simkin DOM class library.


Constructor & Destructor Documentation

skElement::skElement const skString tagname  ) 
 

This constructs a new element with the given tag.

Parameters:
tagname - the tag name to use for the element


Member Function Documentation

void skElement::appendChild skNode child  ) 
 

This adds a child to the list of children owned by this element.

The node's "parent" field is set to this element

Parameters:
child - the child to be added. Note: the child is not copied, and will be deleted by the destructor for this class.
Exceptions:
Symbian - a leaving function

skNode * skElement::clone  )  [virtual]
 

This method returns a new element with the same tag name, attributes and child list.

A deep copy is made.

Returns:
a deep copy of this element
Exceptions:
Symbian - a leaving function

Implements skNode.

skString skElement::getAttribute const skString name,
const skString default_value
const
 

This returns the value of an attribute.

If the attribute does not exist, the default value is returned.

Parameters:
name - the name of the attribute being accessed
default_value - the value returned if the attribute was not found
Returns:
the value associated with the name, or a blank string.

skString skElement::getAttribute const skString name  )  const
 

This returns the value of an attribute.

If the attribute does not exist, a blank string is returned.

Parameters:
name - the name of the attribute being accessed
Returns:
the value associated with the name, or a blank string.

skAttributeList & skElement::getAttributes  ) 
 

This method returns the list of attributes owned by this element.

Returns:
the list of attributes owned by this element

skNodeList & skElement::getChildNodes  ) 
 

This method returns the list of child nodes owned by this element.

Returns:
the list of child nodes owned by this element

skNode::NodeType skElement::getNodeType  )  const [virtual]
 

this returns the type of this node

Returns:
ELEMENT_NODE

Implements skNode.

skString skElement::getTagName  )  const
 

This returns the tag name for the element.

Returns:
the tag name of the element

void skElement::removeAndDestroyChild skNode child  ) 
 

This removes a child from the list of children owned by this element.

The child is deleted by this function.

Parameters:
child - the child to be removed and destroyed.

bool skElement::removeAttribute const skString name  ) 
 

This removes an attribute from the element.

Parameters:
name - the name of the attribute being accessed
Returns:
true if the attribute was removed, false if it was not in the list

void skElement::removeChild skNode child  ) 
 

This removes a child from the list of children owned by this element.

The child is *not* deleted by this function. The child's "parent" field is set to zero.

Parameters:
child - the child to be removed .

void skElement::setAttribute const skString name,
const skString value
 

This sets an attribute of this element.

The attribute is added, if not already present.

Parameters:
name - the name of the attribute. If one already exists with this name, its value is overwritten.
value - the value for the attribute
Exceptions:
Symbian - a leaving function

skString skElement::toString  )  const [virtual]
 

Copies this element, its attributes and children to a string.

Returns:
a string containing this element
Exceptions:
Symbian - a leaving function

Implements skNode.

void skElement::write skOutputDestination out  )  const [virtual]
 

Writes this element, its attributes and children to the given destination.

Parameters:
out - the destination to write to
Exceptions:
Symbian - a leaving function

Implements skNode.


The documentation for this class was generated from the following files:
Generated on Fri Dec 17 20:27:35 2004 for Simkin by doxygen1.3