Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACEXML_Svcconf_Handler Class Reference

ACEXML_Svcconf_Handler is an example SAX event handler. More...

#include <Svcconf_Handler.h>

Inheritance diagram for ACEXML_Svcconf_Handler:

Inheritance graph
[legend]
Collaboration diagram for ACEXML_Svcconf_Handler:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACEXML_Svcconf_Handler (void)
virtual ~ACEXML_Svcconf_Handler (void)
virtual void characters (const ACEXML_Char *ch, int start, int length ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void endDocument (ACEXML_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void endElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void endPrefixMapping (const ACEXML_Char *prefix ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void ignorableWhitespace (const ACEXML_Char *ch, int start, int length ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void processingInstruction (const ACEXML_Char *target, const ACEXML_Char *data ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void setDocumentLocator (ACEXML_Locator *)
virtual void skippedEntity (const ACEXML_Char *name ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void startDocument (ACEXML_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void startElement (const ACEXML_Char *namespaceURI, const ACEXML_Char *localName, const ACEXML_Char *qName, ACEXML_Attributes *atts ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void startPrefixMapping (const ACEXML_Char *prefix, const ACEXML_Char *uri ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void notationDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void unparsedEntityDecl (const ACEXML_Char *name, const ACEXML_Char *publicId, const ACEXML_Char *systemId, const ACEXML_Char *notationName ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual ACEXML_InputSourceresolveEntity (const ACEXML_Char *publicId, const ACEXML_Char *systemId ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void error (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void fatalError (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))
virtual void warning (ACEXML_SAXParseException &exception ACEXML_ENV_ARG_DECL) ACE_THROW_SPEC((ACEXML_SAXException))

Protected Methods

int get_stream_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
int get_id (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
int get_dynamic_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
int get_initializer_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)
int get_static_attrs (ACEXML_Attributes *alist ACEXML_ENV_ARG_DECL)

Private Attributes

int in_stream_def_
 We are parsing a stream definition. More...

int in_module_
 We are defining a steam module. More...

ACE_Parsed_Info parsed_info_
ACE_Parsed_Info stream_info_

Detailed Description

ACEXML_Svcconf_Handler is an example SAX event handler.

This SAX event handler try to regenerate the XML document it reads with correct indentation.

Definition at line 89 of file examples/svcconf/Svcconf_Handler.h.


Constructor & Destructor Documentation

ACEXML_Svcconf_Handler::ACEXML_Svcconf_Handler void   
 

Definition at line 11 of file examples/svcconf/Svcconf_Handler.cpp.

00012   : in_stream_def_ (0),
00013     in_module_ (0)
00014 {
00015   // no-op
00016 }

ACEXML_Svcconf_Handler::~ACEXML_Svcconf_Handler void    [virtual]
 

Definition at line 18 of file examples/svcconf/Svcconf_Handler.cpp.

00019 {
00020   // no-op
00021 }


Member Function Documentation

void ACEXML_Svcconf_Handler::characters const ACEXML_Char   ch,
int    start,
int length    ACEXML_ENV_ARG_DECL
[virtual]
 

Receive notification of character data.

Reimplemented from ACEXML_DefaultHandler.

Definition at line 24 of file examples/svcconf/Svcconf_Handler.cpp.

References ACEXML_Char, and ACEXML_ENV_ARG_DECL_NOT_USED.

00028 {
00029   // no-op
00030 }

void ACEXML_Svcconf_Handler::endDocument ACEXML_ENV_SINGLE_ARG_DECL    [virtual]
 

Receive notification of the end of a document.

Reimplemented from ACEXML_DefaultHandler.

Definition at line 33 of file examples/svcconf/Svcconf_Handler.cpp.

References ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED.

00035 {
00036   // no-op
00037 }

void ACEXML_Svcconf_Handler::endElement const ACEXML_Char   namespaceURI,
const ACEXML_Char   localName,
const ACEXML_Char *qName    ACEXML_ENV_ARG_DECL
[virtual]
 

Receive notification of the end of an element.

Reimplemented from ACEXML_DefaultHandler.

Definition at line 40 of file examples/svcconf/Svcconf_Handler.cpp.

References ACE_DEBUG, ACE_TEXT, ACEXML_Char, ACEXML_ENV_ARG_DECL, LM_INFO, and ACE_OS_String::strcmp.

00044 {
00045 
00046 
00047   if (ACE_OS_String::strcmp (qName, ACE_TEXT ("dynamic")) == 0)
00048     {
00049       if (this->in_stream_def_)
00050         {
00051           ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create dynamic %s for stream\n"),
00052                       this->stream_info_.name ()));
00053         }
00054       else
00055         {
00056           if (this->in_module_)
00057             {
00058               ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push dynamic %s into stream %s\n"),
00059                           this->parsed_info_.name (),
00060                           this->stream_info_.name ()));
00061             }
00062           else
00063             {
00064               ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply dynamic %s\n"),
00065                           this->parsed_info_.name ()));
00066             }
00067           this->parsed_info_.reset ();
00068         }
00069     }
00070   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("static")) == 0)
00071     {
00072       if (this->in_stream_def_)
00073         {
00074           ACE_DEBUG ((LM_INFO, ACE_TEXT ("Create sttaic %s for stream\n"),
00075                       this->stream_info_.name ()));
00076         }
00077       else
00078         {
00079           if (this->in_module_)
00080             {
00081               ACE_DEBUG ((LM_INFO, ACE_TEXT ("Push static %s into stream %s\n"),
00082                           this->parsed_info_.name (),
00083                           this->stream_info_.name ()));
00084             }
00085           else
00086             {
00087               ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply static %s\n"),
00088                           this->parsed_info_.name ()));
00089             }
00090           this->parsed_info_.reset ();
00091         }
00092     }
00093   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("module")) == 0)
00094     {
00095       this->in_module_ = 0;
00096     }
00097   else if (ACE_OS_String::strcmp (qName, ACE_TEXT ("streamdef")) == 0 ||
00098            ACE_OS_String::strcmp (qName, ACE_TEXT ("stream")) == 0)
00099     {
00100       ACE_DEBUG ((LM_INFO, ACE_TEXT ("Apply stream %s of type %s\n"),
00101                   this->stream_info_.name (),
00102                   this->stream_info_.name ()));
00103       this->stream_info_.reset ();
00104     }
00105   else
00106     {
00107     }
00108 }

virtual void ACEXML_Svcconf_Handler::endPrefixMapping const ACEXML_Char *prefix    ACEXML_ENV_ARG_DECL [virtual]
 

End the scope of a prefix-URI mapping.

Reimplemented from ACEXML_DefaultHandler.

virtual void ACEXML_Svcconf_Handler::error ACEXML_SAXParseException &exception    ACEXML_ENV_ARG_DECL [virtual]
 

Receive notification of a recoverable error.

Reimplemented from ACEXML_DefaultHandler.

virtual void ACEXML_Svcconf_Handler::fatalError ACEXML_SAXParseException &exception    ACEXML_ENV_ARG_DECL [virtual]
 

Receive notification of a non-recoverable error.

Reimplemented from ACEXML_DefaultHandler.

int ACEXML_Svcconf_Handler::get_dynamic_attrs ACEXML_Attributes *alist    ACEXML_ENV_ARG_DECL [protected]
 

Get the dynamic tag attributes.

Definition at line 367 of file examples/svcconf/Svcconf_Handler.cpp.

References ACE_TEXT, ACEXML_ENV_ARG_DECL, in_stream_def_, ACE_Parsed_Info::MODULE_TYPE, ACE_Parsed_Info::name, parsed_info_, ACE_Parsed_Info::SERVICE_OBJECT_TYPE, ACE_Parsed_Info::service_type, ACE_OS_String::strcmp, stream_info_, and ACE_Parsed_Info::STREAM_TYPE.

00368 {
00369 
00370 
00371   if (alist != 0)
00372     {
00373       ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00374                                &this->parsed_info_ :
00375                                &this->stream_info_);
00376       for (size_t i = 0; i < alist->getLength (); ++i)
00377         {
00378           if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00379             {
00380               info->name (alist->getValue (i));
00381             }
00382           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("status")) == 0)
00383             {
00384               if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("inactive")) == 0)
00385                 {
00386                 }
00387               else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("active")) == 0)
00388                 {
00389                 }
00390               else
00391                 {
00392                   // @@ error, invalid 'status' value.
00393                 }
00394             }
00395           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("type")) == 0)
00396             {
00397               if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("service_object")) == 0)
00398                 {
00399                   info->service_type (ACE_Parsed_Info::SERVICE_OBJECT_TYPE);
00400                 }
00401               else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("stream")) == 0)
00402                 {
00403                   info->service_type (ACE_Parsed_Info::STREAM_TYPE);
00404                 }
00405               else if (ACE_OS_String::strcmp (alist->getValue (i), ACE_TEXT ("module")) == 0)
00406                 {
00407                   info->service_type (ACE_Parsed_Info::MODULE_TYPE);
00408                 }
00409               else
00410                 {
00411                   // @@ error, invalid 'type' value.
00412                 }
00413             }
00414           else
00415             {
00416               // @@ Exception...
00417               return -1;
00418             }
00419         }
00420     }
00421   return 0;
00422 }

int ACEXML_Svcconf_Handler::get_id ACEXML_Attributes *alist    ACEXML_ENV_ARG_DECL [protected]
 

Get the only attribute in <resume>, <suspend>, <remove>

Definition at line 346 of file examples/svcconf/Svcconf_Handler.cpp.

References ACE_TEXT, ACEXML_ENV_ARG_DECL, ACE_Parsed_Info::name, parsed_info_, and ACE_OS_String::strcmp.

00347 {
00348 
00349 
00350   if (alist != 0)
00351     for (size_t i = 0; i < alist->getLength (); ++i)
00352       {
00353         if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00354           {
00355             this->parsed_info_.name (alist->getValue (i));
00356           }
00357         else
00358           {
00359             // @@ Exception...
00360             return -1;
00361           }
00362       }
00363   return 0;
00364 }

int ACEXML_Svcconf_Handler::get_initializer_attrs ACEXML_Attributes *alist    ACEXML_ENV_ARG_DECL [protected]
 

Get the initializer tag attributes.

Definition at line 425 of file examples/svcconf/Svcconf_Handler.cpp.

References ACE_TEXT, ACEXML_ENV_ARG_DECL, in_stream_def_, ACE_Parsed_Info::init_func, ACE_Parsed_Info::init_params, parsed_info_, ACE_Parsed_Info::path, ACE_OS_String::strcmp, and stream_info_.

00426 {
00427 
00428 
00429   if (alist != 0)
00430     {
00431       ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00432                                &this->parsed_info_ :
00433                                &this->stream_info_);
00434       for (size_t i = 0; i < alist->getLength (); ++i)
00435         {
00436           if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("init")) == 0)
00437             {
00438               info->init_func (alist->getValue (i));
00439             }
00440           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("path")) == 0)
00441             {
00442               info->path (alist->getValue (i));
00443             }
00444           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0)
00445             {
00446               info->init_params (alist->getValue (i));
00447             }
00448           else
00449             {
00450               // @@ Exception...
00451               return -1;
00452             }
00453         }
00454     }
00455   return 0;
00456 }

int ACEXML_Svcconf_Handler::get_static_attrs ACEXML_Attributes *alist    ACEXML_ENV_ARG_DECL [protected]
 

Get the static tag attributes.

Definition at line 459 of file examples/svcconf/Svcconf_Handler.cpp.

References ACE_TEXT, ACEXML_ENV_ARG_DECL, in_stream_def_, ACE_Parsed_Info::init_params, ACE_Parsed_Info::name, parsed_info_, ACE_OS_String::strcmp, and stream_info_.

00460 {
00461 
00462 
00463   if (alist != 0)
00464     {
00465       ACE_Parsed_Info *info = (this->in_stream_def_ == 0 ?
00466                                &this->parsed_info_ :
00467                                &this->stream_info_);
00468       for (size_t i = 0; i < alist->getLength (); ++i)
00469         {
00470           if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00471             {
00472               info->name (alist->getValue (i));
00473             }
00474           else if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("params")) == 0)
00475             {
00476               info->init_params (alist->getValue (i));
00477             }
00478           else
00479             {
00480               // @@ Exception...
00481               return -1;
00482             }
00483         }
00484     }
00485   return 0;
00486 }

int ACEXML_Svcconf_Handler::get_stream_id ACEXML_Attributes *alist    ACEXML_ENV_ARG_DECL [protected]
 

Get the only attribute in <stream> or <streamdef>.

Definition at line 325 of file examples/svcconf/Svcconf_Handler.cpp.

References ACE_TEXT, ACEXML_ENV_ARG_DECL, ACE_Parsed_Info::name, ACE_OS_String::strcmp, and stream_info_.

00326 {
00327 
00328 
00329   if (alist != 0)
00330     for (size_t i = 0; i < alist->getLength (); ++i)
00331       {
00332         if (ACE_OS_String::strcmp (alist->getQName (i), ACE_TEXT ("id")) == 0)
00333           {
00334             this->stream_info_.name (alist->getValue (i));
00335           }
00336         else
00337           {
00338             // @@ Exception...
00339             return -1;
00340           }
00341       }
00342   return 0;
00343 }

void ACEXML_Svcconf_Handler::ignorableWhitespace const ACEXML_Char   ch,
int    start,
int length    ACEXML_ENV_ARG_DECL
[virtual]
 

Receive notification of ignorable whitespace in element content.

Reimplemented from ACEXML_DefaultHandler.

Definition at line 118 of file examples/svcconf/Svcconf_Handler.cpp.

References ACEXML_Char, and ACEXML_ENV_ARG_DECL_NOT_USED.

00122 {
00123   // no-op
00124 }

virtual void ACEXML_Svcconf_Handler::notationDecl const ACEXML_Char   name,
const ACEXML_Char   publicId,
const ACEXML_Char *systemId    ACEXML_ENV_ARG_DECL
[virtual]
 

Receive notification of a notation declaration event.

Reimplemented from ACEXML_DefaultHandler.

virtual void ACEXML_Svcconf_Handler::processingInstruction const ACEXML_Char   target,
const ACEXML_Char *data    ACEXML_ENV_ARG_DECL
[virtual]
 

Receive notification of a processing instruction.

Reimplemented from ACEXML_DefaultHandler.

virtual ACEXML_InputSource* ACEXML_Svcconf_Handler::resolveEntity const ACEXML_Char   publicId,
const ACEXML_Char *systemId    ACEXML_ENV_ARG_DECL
[virtual]
 

Allow the application to resolve external entities.

Reimplemented from ACEXML_DefaultHandler.

void ACEXML_Svcconf_Handler::setDocumentLocator ACEXML_Locator   [virtual]
 

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

Reimplemented from ACEXML_DefaultHandler.

Definition at line 135 of file examples/svcconf/Svcconf_Handler.cpp.

00136 {
00137 }

virtual void ACEXML_Svcconf_Handler::skippedEntity const ACEXML_Char *name    ACEXML_ENV_ARG_DECL [virtual]
 

Receive notification of a skipped entity.

Reimplemented from ACEXML_DefaultHandler.

void ACEXML_Svcconf_Handler::startDocument ACEXML_ENV_SINGLE_ARG_DECL    [virtual]
 

Receive notification of the beginning of a document.

Reimplemented from ACEXML_DefaultHandler.

Definition at line 147 of file examples/svcconf/Svcconf_Handler.cpp.

References ACEXML_ENV_SINGLE_ARG_DECL_NOT_USED.

00149 {
00150   // no-op
00151 }

virtual void ACEXML_Svcconf_Handler::startElement const ACEXML_Char   namespaceURI,
const ACEXML_Char   localName,
const ACEXML_Char   qName,
ACEXML_Attributes *atts    ACEXML_ENV_ARG_DECL
[virtual]
 

Receive notification of the beginning of an element.

Reimplemented from ACEXML_DefaultHandler.

virtual void ACEXML_Svcconf_Handler::startPrefixMapping const ACEXML_Char   prefix,
const ACEXML_Char *uri    ACEXML_ENV_ARG_DECL
[virtual]
 

Begin the scope of a prefix-URI Namespace mapping.

Reimplemented from ACEXML_DefaultHandler.

virtual void ACEXML_Svcconf_Handler::unparsedEntityDecl const ACEXML_Char   name,
const ACEXML_Char   publicId,
const ACEXML_Char   systemId,
const ACEXML_Char *notationName    ACEXML_ENV_ARG_DECL
[virtual]
 

Receive notification of an unparsed entity declaration event.

Reimplemented from ACEXML_DefaultHandler.

virtual void ACEXML_Svcconf_Handler::warning ACEXML_SAXParseException &exception    ACEXML_ENV_ARG_DECL [virtual]
 

Receive notification of a warning.

Reimplemented from ACEXML_DefaultHandler.


Member Data Documentation

int ACEXML_Svcconf_Handler::in_module_ [private]
 

We are defining a steam module.

Definition at line 275 of file examples/svcconf/Svcconf_Handler.h.

int ACEXML_Svcconf_Handler::in_stream_def_ [private]
 

We are parsing a stream definition.

Definition at line 272 of file examples/svcconf/Svcconf_Handler.h.

Referenced by get_dynamic_attrs, get_initializer_attrs, and get_static_attrs.

ACE_Parsed_Info ACEXML_Svcconf_Handler::parsed_info_ [private]
 

Definition at line 277 of file examples/svcconf/Svcconf_Handler.h.

Referenced by get_dynamic_attrs, get_id, get_initializer_attrs, and get_static_attrs.

ACE_Parsed_Info ACEXML_Svcconf_Handler::stream_info_ [private]
 

Definition at line 279 of file examples/svcconf/Svcconf_Handler.h.

Referenced by get_dynamic_attrs, get_initializer_attrs, get_static_attrs, and get_stream_id.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 13:27:31 2003 for ACEXML by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002