Rudiments
Public Member Functions | Protected Member Functions | List of all members
xmldom Class Reference

#include <xmldom.h>

Inherits xmlsax, and dom.

Inherited by codetreegrammar.

Public Member Functions

 xmldom ()
 
 xmldom (bool stringcacheenabled)
 
virtual ~xmldom ()
 
virtual const chargetType ()
 
bool parse (input *in)
 
bool parseFile (const char *filename)
 
bool parseString (const char *string)
 
void createRootNode ()
 
- Public Member Functions inherited from xmlsax
 xmlsax ()
 
virtual ~xmlsax ()
 
- Public Member Functions inherited from sax
 sax ()
 
virtual ~sax ()
 
void setIgnoreHeaderLines (uint64_t lines)
 
uint64_t getIgnoreHeaderLines ()
 
void setIgnoreFooterLines (uint64_t lines)
 
uint64_t getIgnoreFooterLines ()
 
const chargetError ()
 
- Public Member Functions inherited from object
virtual ~object ()
 
- Public Member Functions inherited from dom
 dom ()
 
 dom (bool stringcacheenabled)
 
virtual ~dom ()
 
virtual domnodegetRootNode ()
 
virtual domnodegetNullNode ()
 
virtual ssize_t writeFile (const char *filename, mode_t perms)
 
virtual ssize_t writeFile (const char *filename, mode_t perms, bool indent)
 
virtual ssize_t write ()
 
virtual ssize_t write (bool indent)
 
virtual ssize_t write (output *out)
 
virtual ssize_t write (output *out, bool indent)
 
virtual ssize_t writeXml ()
 
virtual ssize_t writeXml (bool indent)
 
virtual ssize_t writeXml (output *out)
 
virtual ssize_t writeXml (output *out, bool indent)
 
bool getStringCacheEnabled ()
 
- Public Member Functions inherited from collection
 collection ()
 
 collection (collection &c)
 
collectionoperator= (collection &c)
 
virtual ~collection ()
 
virtual uint64_t getCount ()=0
 
comparatorgetComparator ()
 
void setComparator (comparator *newcomp)
 
virtual bool isReadOnly ()
 
virtual bool isBlockBased ()
 
virtual uint64_t getBlockSize ()
 
virtual bool isSequentialAccess ()
 
virtual void setManageValues (bool manage)
 
virtual bool getManageValues ()
 
virtual void setManageArrayValues (bool manage)
 
virtual bool getManageArrayValues ()
 
virtual void setManageKeys (bool manage)
 
virtual bool getManageKeys ()
 
virtual void setManageArrayKeys (bool manage)
 
virtual bool getManageArrayKeys ()
 
virtual bool clear ()=0
 
virtual ssize_t writeJson ()=0
 
virtual ssize_t writeJson (bool indent)=0
 
virtual ssize_t writeJson (output *out)=0
 
virtual ssize_t writeJson (output *out, bool indent)=0
 

Protected Member Functions

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.

It parses a file or string of XML-formatted data and produces a dom tree representing the data.

See the "domnode" class for more detail.

Constructor & Destructor Documentation

◆ xmldom() [1/2]

xmldom::xmldom ( )

Creates a new instance of the xmldom class.

◆ xmldom() [2/2]

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 domnode 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. If the data is highly repetitive this conserves memory at the cost of speed.

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

◆ ~xmldom()

virtual xmldom::~xmldom ( )
virtual

Deletes this instance of the xmldom class.

Member Function Documentation

◆ attributeName()

virtual bool xmldom::attributeName ( const char * name)
protectedvirtual

Gets called when an attribute name is parsed.

Reimplemented from xmlsax.

◆ attributeValue()

virtual bool xmldom::attributeValue ( const char * value)
protectedvirtual

Gets called when an attribute value is parsed.

Reimplemented from xmlsax.

◆ cdata()

virtual bool xmldom::cdata ( const char * string)
protectedvirtual

Gets called when cdata is parsed.

Reimplemented from xmlsax.

◆ comment()

virtual bool xmldom::comment ( const char * string)
protectedvirtual

Gets called when a comment is parsed.

Reimplemented from xmlsax.

◆ createRootNode()

void xmldom::createRootNode ( )
virtual

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

Reimplemented from dom.

◆ getType()

virtual const char * xmldom::getType ( )
virtual

Returns "xmldom".

Reimplemented from dom.

◆ parse()

bool xmldom::parse ( input * in)
virtual

Parses generic input "in" and generates a DOM tree.

Reimplemented from sax.

◆ parseFile()

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

Parses file "filename" and generates a DOM tree.

Reimplemented from sax.

◆ parseString()

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

Parses string "string" and generates a DOM tree.

Reimplemented from sax.

◆ tagEnd()

virtual bool xmldom::tagEnd ( const char * ns,
const char * name )
protectedvirtual

Gets called when an end tag is parsed.

Reimplemented from xmlsax.

◆ tagStart()

virtual bool xmldom::tagStart ( const char * ns,
const char * name )
protectedvirtual

Gets called when a start tag is parsed.

Reimplemented from xmlsax.

◆ text()

virtual bool xmldom::text ( const char * string)
protectedvirtual

Gets called when a block of text is parsed.

Reimplemented from xmlsax.