freedaisy::XMLDoc Class Reference

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

#include <xmldoc.h>

Inheritance diagram for freedaisy::XMLDoc:

[legend]
List of all members.

Public Member Functions

 XMLDoc ()
 Create an empty document.
 XMLDoc (std::string filename)
 Create the object and parse a document.
 ~XMLDoc ()
 Delete an XML document.
void parseFile (std::string filename)
 Parse an XML document.
void saveFile (std::string filename)
 Save the tree into an XML file.
void createDoc ()
 Create an XML document.
std::vector< XMLNodexpathEval (std::string request)
 Evaluate an XPath request.
xmlDocPtr getC ()
 Gets the C xmlDocPtr object.
XMLNode createRootNode (std::string name)
 Create the root node.

Protected Member Functions

void _createDoc ()
 Create the XML document.

Protected Attributes

xmlDocPtr _xmldoc
 libxml2 object

Detailed Description

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

Example:

    freedaisy::XMLDoc doc("file.xml");
    std::cout << doc.xpathEval("//root/test")[0].getContent() << std::endl;

Definition at line 21 of file xmldoc.h.


Constructor & Destructor Documentation

freedaisy::XMLDoc::XMLDoc std::string  filename  ) 
 

Create the object and parse a document.

Parameters:
filename Filename to parse

Definition at line 12 of file xmldoc.cpp.

References _xmldoc, and parseFile().


Member Function Documentation

void freedaisy::XMLDoc::_createDoc  )  [protected]
 

Create the XML document.

This function is called by createDoc() to create the XML document.

The goal of createDoc() is to be modified by child classes, this function helps to have the same XML creation function and avoid code duplication.

Definition at line 41 of file xmldoc.cpp.

References _xmldoc.

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

XMLNode freedaisy::XMLDoc::createRootNode std::string  name  ) 
 

Create the root node.

Todo:
Avoid root node duplication
Parameters:
name Name of the root node

Definition at line 72 of file xmldoc.cpp.

References _xmldoc.

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

void freedaisy::XMLDoc::parseFile std::string  filename  ) 
 

Parse an XML document.

Parameters:
filename Filename to parse

Definition at line 21 of file xmldoc.cpp.

References _xmldoc.

Referenced by XMLDoc().

void freedaisy::XMLDoc::saveFile std::string  filename  ) 
 

Save the tree into an XML file.

Parameters:
filename Destination filename

Definition at line 31 of file xmldoc.cpp.

References _xmldoc.

std::vector< XMLNode > freedaisy::XMLDoc::xpathEval std::string  request  ) 
 

Evaluate an XPath request.

Parameters:
request XPath expression

Definition at line 55 of file xmldoc.cpp.

References _xmldoc.

Referenced by freedaisy::Discinfo::addLink(), freedaisy::NCC::addMeta(), freedaisy::Discinfo::delLink(), freedaisy::SMIL::findAnchor(), freedaisy::NCC::getBody(), freedaisy::NCC::getLang(), freedaisy::Discinfo::getLang(), freedaisy::Discinfo::getLinks(), freedaisy::NCC::getMeta(), freedaisy::NCC::getPage(), freedaisy::NCC::getTitle(), freedaisy::NCC::setLang(), freedaisy::Discinfo::setLang(), 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