Rudiments

- Main Page
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
xmldom Class Reference

Inherits xmlsax.

Inherited by codetreegrammar.

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

## Additional Inherited Members
Protected Member Functions inherited from xmlsax
virtual bool | tagStart (const char *ns, 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 *ns, 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::getNullNode | ( |  | ) | const

Returns the null node of the DOM tree.

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

Returns the root node of the DOM tree.

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

Parses file "filename" and generates a DOM tree.

Reimplemented from xmlsax.

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

Parses string "string" and generates a DOM tree.

Reimplemented from xmlsax.

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".