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 Methods

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

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

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

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

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

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

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

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

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

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


Protected Methods

skAttributefindAttribute (const skString& name) const
 this method finds a named attribute.


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.

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

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

Reimplemented from skNode.

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.

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

NodeType skElement::getNodeType ( ) const [virtual]
 

this returns the type of this node.

Returns:
ELEMENT_NODE

Reimplemented from 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.

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

void skElement::write ( ostream & out ) const [virtual]
 

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

Parameters:
out   - the stream to write to

Reimplemented from skNode.


The documentation for this class was generated from the following files:
Generated at Mon Nov 5 19:22:25 2001 for Simkin by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000