Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

XmlParser Class Reference

List of all members.

Public Member Functions

void addChild (string const &name, string &value)
void addChild (const char *name, const char *value)
void addGroup (string const &name)
void addGroup (const char *name)
void addLineFeed ()
int close ()
void endGroup ()
char * getAttr (const char *field, const char *attr)
xmlDocPtr getDoc ()
time_t getLastModTime ()
char * getValue (string const &field)
char * getValue (const char *field)
void newfile (string const &root)
void newfile (const char *root)
int open (string const &filename)
int open (const char *filename)
int openMemBuf (MemBuf &)
int save (string const &filename, int *nbytes=0)
int save (const char *filename, int *nbytes=0)
int saveMemBuf (MemBuf &, int *nbytes=0)
void setAttr (string &name, string &value)
void setAttr (const char *name, const char *value)
int setValue (const char *field, const char *value)
 XmlParser ()
 ~XmlParser ()

Static Public Member Functions

bool cleanXML ()
bool startXML ()

Private Attributes

string buffer
xmlNodePtr cur
xmlDocPtr doc
xmlNodePtr lastNode
time_t mtime
xmlNodePtr prevCur

Detailed Description

This class is used to open a .xml file and read information from it.


Constructor & Destructor Documentation

XmlParser::XmlParser  ) 
 

Constructor of the XmlParser class

XmlParser::~XmlParser  ) 
 

Destructor of the XmlParser class Destroys the XmlParser object


Member Function Documentation

void XmlParser::addChild string const &  name,
string &  value
 

void XmlParser::addChild const char *  name,
const char *  value
 

Adds a new child element entry

Parameters:
name Child name
value Value of the child

void XmlParser::addGroup string const &  name  ) 
 

void XmlParser::addGroup const char *  name  ) 
 

Starts a new sub group Only one level for now

Parameters:
name Name of the sub group

void XmlParser::addLineFeed  ) 
 

Adds a line feed to the XML data

bool XmlParser::cleanXML  )  [static]
 

Cleans up the libxml2 library.

Returns:
Returns true

int XmlParser::close  ) 
 

Frees the memory, use by the XmlParser class

void XmlParser::endGroup  ) 
 

Ends the sub group, if any Only one level for now

char * XmlParser::getAttr const char *  field,
const char *  attr
 

Gets the attribute for the node field.

Parameters:
field Field
attr Attribute
Returns:

xmlDocPtr XmlParser::getDoc  ) 
 

Returns the XML document

Returns:
Returns XML document

time_t XmlParser::getLastModTime  ) 
 

Gets the last modification time of the file

Returns:
Returns last modification time

char* XmlParser::getValue string const &  field  ) 
 

char * XmlParser::getValue const char *  vName  ) 
 

Gets the value of the vName root child element.

Parameters:
vName vName of the root child elment
Returns:
Returns the value of the vName

void XmlParser::newfile string const &  root  ) 
 

void XmlParser::newfile const char *  root  ) 
 

Starts a new XML tree for a new file

Parameters:
root roote elment entry

int XmlParser::open string const &  filename  ) 
 

int XmlParser::open const char *  filename  ) 
 

Opens a files and stores it in memory.

Parameters:
filename The filename
Returns:
Returns 0 on success, non zero values on failure

int XmlParser::openMemBuf MemBuf memory  ) 
 

Read the XML data from a char array

Parameters:
memory Memory Buffer
Returns:
Returns 0 on succes, non 0 on failure

int XmlParser::save string const &  filename,
int *  nbytes = 0
 

int XmlParser::save const char *  filename,
int *  nbytes = 0
 

Saves the XML tree into a file If no errors occur nbytes[optional] will contain the amount of written bytes

Parameters:
filename Filename
nbytes Amount of bytes
Returns:
Returns 0 on success, non 0 on failures

int XmlParser::saveMemBuf MemBuf memory,
int *  nbytes = 0
 

Saves the XML tree into memory If no errors occur nbytes[optional] will contain the amount of written bytes

Parameters:
memory Memory Buffer
nbytes Amount of bytes
Returns:
Returns 0 on success, non 0 on failures

void XmlParser::setAttr string &  name,
string &  value
 

void XmlParser::setAttr const char *  name,
const char *  value
 

Sets an attribute, using the last node entry

Parameters:
name Name
value Value

int XmlParser::setValue const char *  vName,
const char *  value
 

Sets the value of the vName root child element

Parameters:
vName 
value 
Returns:
Returns 0 on success, non zero on failures

bool XmlParser::startXML  )  [static]
 

Initializes the libxml2 library Calls xmlInitParser()

Returns:
Returns true


Member Data Documentation

string XmlParser::buffer [private]
 

xmlNodePtr XmlParser::cur [private]
 

xmlDocPtr XmlParser::doc [private]
 

xmlNodePtr XmlParser::lastNode [private]
 

time_t XmlParser::mtime [private]
 

xmlNodePtr XmlParser::prevCur [private]
 


Generated on Thu May 1 12:41:06 2008 for MyServer by  doxygen 1.3.9.1