freedaisy::XMLNode Class Reference

XML Node class for easy XML manipulation in C++. More...

#include <xmlnode.h>

Inheritance diagram for freedaisy::XMLNode:

[legend]
List of all members.

Public Member Functions

 XMLNode ()
 Create an empty XMLNode.
 XMLNode (std::string name)
 Create an empty XMLNode with a node name.
 XMLNode (xmlNodePtr src)
 Create an XMLNode from a xmlNodePtr.
 XMLNode (XMLNode *src)
 Create an XMLNode from an XMLNode.
std::string operator[] (std::string attr)
 Get an attribute using the operator [].
std::string getName ()
 Get the node name.
std::string getContent ()
 Get the node content.
void setContent (std::string content)
 Set the node content.
int hasAttr (std::string name)
std::string getAttr (std::string name)
 Get an attribute.
void setAttr (std::string name, std::string attr)
 Set an attribute.
void addChild (XMLNode *cur)
 Add a child.
std::vector< XMLNodegetChildren ()
 Get children.
std::vector< XMLNodegetNextNodes (bool withme=false)
 Get next nodes.
XMLNode getParent ()
 Get parent.
void unlink ()
 Unlink a node.
xmlNodePtr getC ()
 Gets the C xmlNodePtr object.

Protected Attributes

xmlNodePtr _xmlnode
 libxml2 object

Detailed Description

XML Node class for easy XML manipulation in C++.

Definition at line 12 of file xmlnode.h.


Constructor & Destructor Documentation

freedaisy::XMLNode::XMLNode XMLNode src  ) 
 

Create an XMLNode from an XMLNode.

This is useful for derivated classes

Definition at line 19 of file xmlnode.cpp.

References _xmlnode, and getC().


Member Function Documentation

std::string freedaisy::XMLNode::getAttr std::string  name  ) 
 

Get an attribute.

Parameters:
name Attribute name

Definition at line 47 of file xmlnode.cpp.

References _xmlnode.

Referenced by freedaisy::Meta::getContent(), freedaisy::Link::getHref(), freedaisy::Meta::getName(), freedaisy::Meta::getScheme(), and operator[]().

std::vector< XMLNode > freedaisy::XMLNode::getNextNodes bool  withme = false  ) 
 

Get next nodes.

Parameters:
withme Include this node in list

Definition at line 65 of file xmlnode.cpp.

References _xmlnode, and XMLNode().

std::string freedaisy::XMLNode::operator[] std::string  attr  ) 
 

Get an attribute using the operator [].

Example :

      std::cout << node["href"] << std::endl; // Prints the href attribute

Definition at line 23 of file xmlnode.cpp.

References getAttr().

void freedaisy::XMLNode::setAttr std::string  name,
std::string  attr
 

Set an attribute.

Parameters:
name Attribute name
attr Attribute content

Definition at line 51 of file xmlnode.cpp.

References _xmlnode.

Referenced by freedaisy::SMIL::createDoc(), freedaisy::NCC::createDoc(), freedaisy::Discinfo::createDoc(), freedaisy::Meta::setContent(), freedaisy::Link::setHref(), freedaisy::NCC::setLang(), freedaisy::Discinfo::setLang(), freedaisy::Meta::setName(), and freedaisy::Meta::setScheme().

void freedaisy::XMLNode::setContent std::string  content  ) 
 

Set the node content.

Parameters:
content New node content

Reimplemented in freedaisy::Meta.

Definition at line 35 of file xmlnode.cpp.

References _xmlnode.

Referenced by freedaisy::NCC::createDoc(), freedaisy::Discinfo::createDoc(), and freedaisy::NCC::setTitle().


The documentation for this class was generated from the following files:
Generated on Sun Jun 25 23:35:45 2006 for libdaisy by  doxygen 1.4.6