xmldom Class Reference

Inherits xmlsax.

## Public Member Functions

| xmldom ()
| xmldom (bool stringcacheenabled)
virtual | ~xmldom ()
bool | parseFile (const char *filename)
bool | parseString (const char *string)
xmldomnode * | getRootNode () const
void | createRootNode ()
bool | writeFile (const char *filename, mode_t perms) const
bool | stringCacheEnabled ()
Public Member Functions inherited from xmlsax
| xmlsax ()
virtual | ~xmlsax ()
bool | parseFile (const char *filename)
bool | parseString (const char *string)
const char * | getError ()

## Additional Inherited Members

Protected Member Functions inherited from xmlsax
virtual bool | tagStart (const char *name)
virtual bool | attributeName (const char *name)
virtual bool | attributeValue (const char *value)
virtual bool | text (const char *string)
virtual bool | tagEnd (const char *name)
virtual bool | comment (const char *string)
virtual bool | cdata (const char *string)

## Detailed Description

The xmldom class implements a minimal XML DOM parser.

## Constructor & Destructor Documentation

xmldom::xmldom | ( |  | ) |

Creates a new instance of the xmldom class.

xmldom::xmldom | ( | bool | stringcacheenabled | ) |

Creates a new instance of the xmldom class, allowing the user to enable or disable the "string cache" for this instance.

By default, as each xmldomnode is added to the xmldom tree, tag and attribute names and values are stored in a string cache and pointers into the cache are assigned to each node. Reference counters are kept and the string is removed from the cache when no more nodes are using it. As xml tends to be highly repetitive this conserves memory at the cost of speed.

If the string cache is disabled then memory is allocated in each xmldomnode for names and values and freed when the xmldomnode is freed. This is faster but uses much more memory.

virtual xmldom::~xmldom | ( |  | ) |

virtual

Deletes this instance of the xmldom class.

## Member Function Documentation

void xmldom::createRootNode | ( |  | ) |

Creates a new root node. This is useful for building a tree from scratch.

xmldomnode* xmldom::getRootNode | ( |  | ) | const

Returns the root node of the DOM tree.

bool xmldom::parseFile | ( | const char * | filename | ) |

Parses file "filename" and generates a DOM tree.

bool xmldom::parseString | ( | const char * | string | ) |

Parses string "string" and generates a DOM tree.

bool xmldom::stringCacheEnabled | ( |  | ) |

Returns true if the string cache is enabled and false if it is disabled.

bool xmldom::writeFile | ( | const char * | filename,
|  | mode_t | perms
| ) |  | const

Writes the current DOM tree to "filename" and sets permissions of the file to "perms".