Main Page   Class Hierarchy   Alphabetical List   Compound List   Compound Members  

util::xml::Element Class Reference

#include <XMLDocument.h>

Inheritance diagram for util::xml::Element:

util::xml::Node util::Object List of all members.

Detailed Description

Element represents a tag in XML markup.

An opening element can have both children and attributes (which are in fact children, too). An empty element may have attributes but no other children. A closing element may have no children and no attributes.


Public Types

enum  Type { TAG_OPENING, TAG_CLOSING, TAG_EMPTY }
 Possible tag types. More...


Public Methods

 Element (std::string name, Type type=TAG_OPENING)
 Create a new element with the given name and type.

 Element (const Element &other)
 Copy an element.

Element & operator= (const Element &other)
 Copy an element.

std::string getAttribute (std::string name)
 Get a given attribute in this element.

AttrgetAttributeNode (std::string name)
 Get a given attribute in this element.

void setAttribute (std::string name, std::string value)
 Set an attribute in this element.

void setAttributeNode (Attr *node)
 Set an attribute in this element.

void appendChild (Node *child)
 Add a child node to this Element.

void removeChild (Node *child)
 Remove a child node from this Element.

std::string getName () const
 Get the tag name of this element.

void printOut (std::ostream &out) const throw (util::io::IOException&)
 Print out an element.


Public Attributes

std::string tagName
 The tag name of this element.

Type tagType
 The tag type of this element.


Member Enumeration Documentation

enum util::xml::Element::Type
 

Possible tag types.

  • TAG_OPENING - <tag>
  • TAG_CLOSING - </tag>
  • TAG_EMPTY - <tag/>


Member Function Documentation

void util::xml::Element::appendChild Node   child
 

Add a child node to this Element.

Overridden to handle attributes specially.

Reimplemented from util::xml::Node.

string util::xml::Element::getAttribute std::string    name
 

Get a given attribute in this element.

Parameters:
name  the name of the attribute
Returns:
the value of the attribute, or "" if there is no such attribute

Attr * util::xml::Element::getAttributeNode std::string    name
 

Get a given attribute in this element.

Parameters:
name  the name of the attribute
Returns:
the attribute node, or NULL if there is no such attribute

void util::xml::Element::printOut std::ostream &    out const throw (util::io::IOException&) [virtual]
 

Print out an element.

Printing an element causes its children to be printed as well. Children of type ATTRIBUTE_NODE are treated specially as they must be printed inside a tag.

Implements util::xml::Node.

void util::xml::Element::removeChild Node   child
 

Remove a child node from this Element.

Overridden to handle attributes specially.

Reimplemented from util::xml::Node.

void util::xml::Element::setAttribute std::string    name,
std::string    value
[inline]
 

Set an attribute in this element.

Parameters:
name  the name of the attribute
value  the new value for the attribute

void util::xml::Element::setAttributeNode Attr   node [inline]
 

Set an attribute in this element.

Parameters:
node  an attribute node


The documentation for this class was generated from the following files:
Documentation generated on 11.09.2003 with Doxygen.
The documentation is copyrighted material.
Copyright © Topi Mäenpää 2003. All rights reserved.