Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CIAO::XMLHelpers::Cascadable_DocHandler Class Reference

A helper class for implementing cascadable XML Document Handler. More...

#include <Cascadable_DocHandler.h>

Inheritance diagram for CIAO::XMLHelpers::Cascadable_DocHandler:

Inheritance graph
[legend]
Collaboration diagram for CIAO::XMLHelpers::Cascadable_DocHandler:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Cascadable_DocHandler (ACEXML_XMLReader *parser, Cascadable_DocHandler *parent, const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) throw (ACEXML_SAXException)
virtual ~Cascadable_DocHandler (void)
virtual void destroy ()
void push_handler (Cascadable_DocHandler *new_handler, ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) throw (ACEXML_SAXException)
void pop_handler (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) throw (ACEXML_SAXException)
const ACEXML_CharnamespaceURI (void) const
const ACEXML_CharlocalName (void) const
const ACEXML_CharqName (void) const
virtual void setDocumentLocator (ACEXML_Locator *locator)
virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) throw (ACEXML_SAXException)
virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) throw (ACEXML_SAXException)
virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) throw (ACEXML_SAXException)

Protected Member Functions

virtual void print_warning (const ACEXML_Char *level, ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) throw (ACEXML_SAXException)

Protected Attributes

ACEXML_CharnamespaceURI_
ACEXML_CharlocalName_
ACEXML_CharqName_
ACEXML_XMLReaderparser_
 Pointer to the parser that send us events.
Cascadable_DocHandlerparent_
Cascadable_DocHandlerchild_
 Pointer to the child event handler that handles a sub-element.

Private Member Functions

 Cascadable_DocHandler ()
 No implement.

Private Attributes

ACEXML_Locatorlocator_
 Pointer to Locator.

Detailed Description

A helper class for implementing cascadable XML Document Handler.

This class is available as a convenience base class for writing cascadable XML Document DefaultHandler. This class implement the basic functionality for DocHandlers that can be cascaded together to handling nested XML tags. Users can write specific handlers to handle specific XML elements so they can be composed together to handle complex XML definitions. This class utilize the "Interpreter" design pattern as described in GoF.

Application writers should extend this class to implement a handler that interpret a specific XML element. There are just a few rules to use the Cascadable_DocHandler.

1. A Cascadable_DocHandler determines whether a new Cascadable_DocHandler should be used to handle a subelement in its startElement method. When it encounter a subelement that requires a different implementation of Cascadable_DocHandler, it should create the new Cascadable_DocHandler, and then invoke the push_handler method to inform the parser to use the new handler (this in effect switches all four handlers the parse uses to the new handler.)

2. A Cascadable_DocHandler determines whether it has done handling an element structure in endElement method, it invoke the pop_handler method of its parent handler. The pop_handler in turn invokes the endElement eventhandler of the parent handler so it has a chance to harvest the parse result from the child handler.

See the Handler-Interaction.png for how handlers interact with each other.

See also:
ACEXML_DefaultHandler

DocHandler_Context


Constructor & Destructor Documentation

CIAO::XMLHelpers::Cascadable_DocHandler::Cascadable_DocHandler ACEXML_XMLReader parser,
Cascadable_DocHandler parent,
const ACEXML_Char namespaceURI,
const ACEXML_Char localName,
const ACEXML_Char qName,
ACEXML_Attributes *atts  ACEXML_ENV_ARG_DECL
throw (ACEXML_SAXException)
 

Constructor.

CIAO::XMLHelpers::Cascadable_DocHandler::~Cascadable_DocHandler void   )  [virtual]
 

destructor.

CIAO::XMLHelpers::Cascadable_DocHandler::Cascadable_DocHandler  )  [private]
 

No implement.


Member Function Documentation

void CIAO::XMLHelpers::Cascadable_DocHandler::destroy  )  [virtual]
 

Destroy method.

virtual void CIAO::XMLHelpers::Cascadable_DocHandler::error ACEXML_SAXParseException &exception  ACEXML_ENV_ARG_DECL  )  throw (ACEXML_SAXException) [virtual]
 

Receive notification of a recoverable error.

Reimplemented from ACEXML_DefaultHandler.

Reimplemented in Svcconf_Handler.

virtual void CIAO::XMLHelpers::Cascadable_DocHandler::fatalError ACEXML_SAXParseException &exception  ACEXML_ENV_ARG_DECL  )  throw (ACEXML_SAXException) [virtual]
 

Receive notification of a non-recoverable error.

Reimplemented from ACEXML_DefaultHandler.

Reimplemented in Svcconf_Handler.

ACE_INLINE const ACEXML_Char * CIAO::XMLHelpers::Cascadable_DocHandler::localName void   )  const
 

ACE_INLINE const ACEXML_Char * CIAO::XMLHelpers::Cascadable_DocHandler::namespaceURI void   )  const
 

Accessors for the element Context we are in. Make copy if you need to store the return strings for later use.

void CIAO::XMLHelpers::Cascadable_DocHandler::pop_handler const ACEXML_Char namespaceURI,
const ACEXML_Char localName,
const ACEXML_Char *qName  ACEXML_ENV_ARG_DECL
throw (ACEXML_SAXException)
 

This function should be called at the end of endElement method of this Handler to restore the Handler's used by the parser. This method aldo invokes the endElement method of the parent Handler before restoring the parser Handlers. This allows the parent handler to have a chance to harvest the parse result from this Handler. pop_handler will eventually invoke the destroy method of child handler. Since pop_handler should be invoked from child handler's endElement method, care should be taken to avoid accessing free'ed memory after calling parent's pop_handler method.

virtual void CIAO::XMLHelpers::Cascadable_DocHandler::print_warning const ACEXML_Char level,
ACEXML_SAXParseException &exception  ACEXML_ENV_ARG_DECL
throw (ACEXML_SAXException) [protected, virtual]
 

Print out an error/warning message

void CIAO::XMLHelpers::Cascadable_DocHandler::push_handler Cascadable_DocHandler new_handler,
ACEXML_Attributes *atts  ACEXML_ENV_ARG_DECL
throw (ACEXML_SAXException)
 

THIS function should be called by the startElement method of the parent Handler to replace it (the current *Handlers) the parser is using with the this Handler. This method will also invoke the startElement operations of this Handler.

@ I haven't figured out what should happen if an exception occurs in push_handler. It can either restore the original handler, or let the user decide what to do.

ACE_INLINE const ACEXML_Char * CIAO::XMLHelpers::Cascadable_DocHandler::qName void   )  const
 

ACE_INLINE void CIAO::XMLHelpers::Cascadable_DocHandler::setDocumentLocator ACEXML_Locator locator  )  [virtual]
 

Receive an object for locating the origin of SAX document events.

Reimplemented from ACEXML_DefaultHandler.

Reimplemented in Svcconf_Handler.

virtual void CIAO::XMLHelpers::Cascadable_DocHandler::warning ACEXML_SAXParseException &exception  ACEXML_ENV_ARG_DECL  )  throw (ACEXML_SAXException) [virtual]
 

Receive notification of a warning.

Reimplemented from ACEXML_DefaultHandler.

Reimplemented in Svcconf_Handler.


Member Data Documentation

Cascadable_DocHandler* CIAO::XMLHelpers::Cascadable_DocHandler::child_ [protected]
 

Pointer to the child event handler that handles a sub-element.

ACEXML_Char* CIAO::XMLHelpers::Cascadable_DocHandler::localName_ [protected]
 

ACEXML_Locator* CIAO::XMLHelpers::Cascadable_DocHandler::locator_ [private]
 

Pointer to Locator.

ACEXML_Char* CIAO::XMLHelpers::Cascadable_DocHandler::namespaceURI_ [protected]
 

Element tag information.

Cascadable_DocHandler* CIAO::XMLHelpers::Cascadable_DocHandler::parent_ [protected]
 

Pointer to the parent event handler that handles the parent element.

ACEXML_XMLReader* CIAO::XMLHelpers::Cascadable_DocHandler::parser_ [protected]
 

Pointer to the parser that send us events.

ACEXML_Char* CIAO::XMLHelpers::Cascadable_DocHandler::qName_ [protected]
 


The documentation for this class was generated from the following files:
Generated on Sat Aug 6 03:51:35 2005 for XML_HELPERS by  doxygen 1.3.9.1