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

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

virtual IMPORT_C ~skElement ()
 Virtual destructor.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

bool IMPORT_C 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

IMPORT_C 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

IMPORT_C 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

virtual IMPORT_C 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.

IMPORT_C skString skElement::getAttribute const TDesC &  name  )  const
 

This returns the value of an attribute.

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

Remarks:
only available in Symbian version
Parameters:
name - the name of the attribute being accessed
Returns:
the value associated with the name, or a blank string.

IMPORT_C 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.

IMPORT_C 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.

IMPORT_C skAttributeList& skElement::getAttributes  ) 
 

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

Returns:
the list of attributes owned by this element

IMPORT_C 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

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

this returns the type of this node

Returns:
ELEMENT_NODE

Implements skNode.

IMPORT_C skString skElement::getTagName  )  const
 

This returns the tag name for the element.

Returns:
the tag name of the element

IMPORT_C 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.

IMPORT_C 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

IMPORT_C 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 .

IMPORT_C 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

virtual IMPORT_C 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.

virtual IMPORT_C 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 file:
Generated on Fri Dec 17 20:28:27 2004 for Simkin C++ for Symbian by doxygen1.3