Faith::MiniXML Class Reference

#include <faith/minixml.h>

List of all members.

Public Types

 NoClosingTag = 1
 Other = 1000
 User = 5000
enum  Error {
  NoClosingTag = 1, IncompleteEntity, IllegalCharacter, NoAttributeName,
  Other = 1000, User = 5000

Public Member Functions

 MiniXML ()
virtual ~MiniXML ()
bool parse (const String &doc)
virtual bool startElement (const String &name, const std::map< String, String > &attributes)
virtual bool endElement (const String &name)
virtual bool text (const String &text)
virtual Faith::String resolveEntity (const String &entity)
virtual void error (Error error, int offset, int line, int ch)

Detailed Description

MiniXML is a simple and fast parser for a subset of the XML format.

MiniXML supports tags, attributes, and text.

inherit from it, call parse, and the "start" and "end" functions, as well as text() will be called as per the data.

If there are any errors in the document (and MiniXML is quite pedantic...), error() will be called, and processing will then be aborted.

Member Enumeration Documentation

enum Faith::MiniXML::Error

defines a few possible errors


Constructor & Destructor Documentation

Faith::MiniXML::MiniXML (  ) 

virtual Faith::MiniXML::~MiniXML (  )  [virtual]

Member Function Documentation

virtual bool Faith::MiniXML::endElement ( const String name  )  [inline, virtual]

marks the end of an element (tag).

See also:
false if an error was encountered and processing should end
this function will always relate to the last element passed to startElement, so name will be the name of the last started, and not ended element.

You should reimplement this.

virtual void Faith::MiniXML::error ( Error  error,
int  offset,
int  line,
int  ch 
) [inline, virtual]

called when an error was found, and processing is aborted.

error is the cause of the error.
offset what position in the input string the error was encountered
line is approximately what line it was encountered on (UNIMPLEMENTED!!!)
ch is approximately what character on the line it was encountered on. (UNIMPLEMENTED!!!)

bool Faith::MiniXML::parse ( const String doc  ) 

parse the given document

false if an error was encountered, and processing was aborted

virtual Faith::String Faith::MiniXML::resolveEntity ( const String entity  )  [virtual]

Resolves an entity, by default, it converts a few well known entities including: lt, gt, and amp. But this is not necessarily an all-inclusive list. You can reimplement this to add more entities.

entity is the name of the entity (excluding leading ampersand and ending semicolon.

the text the entity should be replaced with.

virtual bool Faith::MiniXML::startElement ( const String name,
const std::map< String, String > &  attributes 
) [inline, virtual]

marks the beginning of an element (tag).

See also:
false if an error was encountered, and processing should end
You should reimplement this.

virtual bool Faith::MiniXML::text ( const String text  )  [inline, virtual]

marks the presence of some text in the XML document. This may be called twice per single block of text without any tags, but usually not

You should reimplement this.

The documentation for this class was generated from the following file:
Generated on Fri Sep 1 00:23:09 2006 for Faith by  doxygen 1.4.7