StructureDocumentHandler Class Reference

A StructureDocumentHandler is the main object used to parse a XML document. More...

#include <structuredocumenthandler.h>

List of all members.

Public Member Functions

 StructureDocumentHandler (StructureHandler *pHandler)
 Constructor.
 ~StructureDocumentHandler ()
 Destructor.
void startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &atts)
 This method is called when an element is started.
void endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
 This method is called when an element is ended.
void characters (const XMLCh *const chars, const unsigned int length)
 This method is called when characters data inside an element are found.
void fatalError (const SAXParseException &exc)
 Reports a fatal XML parsing error.
SAXParseException * getParsingException () const
 It returns exception caught during parsing, null if nothing was caught.
bool isError () const
 It tells if an error occurs during parsing. true If an error occurs during parsing, false otherwise.

Protected Attributes

ostringstream m_Buffer
 Buffer used to read character data.
int m_iNestedDepth
 Nested depth reached.
int m_iContextDepth
 Last depth reached when handler have switched.
StructureHandlerm_pHandler
 Current handler used to parse XML document.
stack< HandlerContext * > m_ContextStack
 Stack containing the list of HandlerContext.
SAXParseException * m_pException
 Exception caught during parsing.
bool m_bParsingError
 Parsing error. true If an error occurs during parsing, false otherwise.


Detailed Description

A StructureDocumentHandler is the main object used to parse a XML document.

It used different StructureHandler object to parse the XML document. Each time, it meets a new element, we get the StructureHandler object able to parse this structure. The new StructureHandler is given by the current StructureHandler used. If we need to switch to a new StructureHandler, we save the context of the current StructureHandler, and switch to the new one. And so on. When it meets the end of an element which makes a switch, we restore the previous one thanks to a call stack.

Author:
Sylvain Archenault <sylvain.archenault@laposte.net>

Yves Houpert <yves.houpert@insa-rouen.fr>


Constructor & Destructor Documentation

StructureDocumentHandler::StructureDocumentHandler StructureHandler pHandler  ) 
 

Constructor.

Parameters:
pHandler First handler used to parse the XML document.


Member Function Documentation

void StructureDocumentHandler::characters const XMLCh *const   chars,
const unsigned int  length
 

This method is called when characters data inside an element are found.

Parameters:
chars The characters.
length The number of characters to use from the character array.
Exceptions:
SAXException Any SAX exception, possibly wrapping another exception.

void StructureDocumentHandler::endElement const XMLCh *const   uri,
const XMLCh *const   localname,
const XMLCh *const   qname
 

This method is called when an element is ended.

Parameters:
uri The URI of the asscioated namespace for this element
localname The local part of the element name
qname The real name of this element
Exceptions:
SAXException Any SAX exception, possibly wrapping another exception.

void StructureDocumentHandler::fatalError const SAXParseException &  exc  ) 
 

Reports a fatal XML parsing error.

Parameters:
exc Exception thrown.

SAXParseException* StructureDocumentHandler::getParsingException  )  const [inline]
 

It returns exception caught during parsing, null if nothing was caught.

Returns:
Exception caught

void StructureDocumentHandler::startElement const XMLCh *const   uri,
const XMLCh *const   localname,
const XMLCh *const   qname,
const Attributes &  atts
 

This method is called when an element is started.

Parameters:
uri The URI of the asscioated namespace for this element
localname The local part of the element name
qname The real name of this element
atts The specified or defaulted attributes.
Exceptions:
SAXException Any SAX exception, possibly wrapping another exception.


Member Data Documentation

stack<HandlerContext*> StructureDocumentHandler::m_ContextStack [protected]
 

Stack containing the list of HandlerContext.

This stack is used to set a previous handler.

int StructureDocumentHandler::m_iNestedDepth [protected]
 

Nested depth reached.

It corresponds to the number of element still open.


The documentation for this class was generated from the following files:
Generated on Fri May 19 12:15:55 2006 for Bamboo Ch@t by  doxygen 1.4.6