00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file XML_Loader.h 00006 * 00007 * $Id: XML_Loader.h 82940 2008-10-06 18:20:19Z johnnyw $ 00008 * 00009 * A topology saver class that outputs XML. 00010 * 00011 * @author Jonathan Pollack <pollack_j@ociweb.com> 00012 */ 00013 //============================================================================= 00014 00015 #ifndef XML_LOADER_H 00016 #define XML_LOADER_H 00017 #include /**/ "ace/pre.h" 00018 #include /**/ "ace/config-all.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 #pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "orbsvcs/Notify/Topology_Loader.h" 00025 00026 #include "ACEXML/common/DefaultHandler.h" 00027 #include "ACEXML/parser/parser/Parser.h" 00028 #include "ACEXML/common/FileCharStream.h" 00029 00030 #include "ace/streams.h" 00031 00032 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00033 00034 namespace TAO_Notify 00035 { 00036 /// \brief Load Notification Service Topology from an XML file. 00037 class XML_Loader : public ACEXML_DefaultHandler , public Topology_Loader 00038 { 00039 public: 00040 /// The constructor. 00041 XML_Loader (); 00042 00043 virtual ~XML_Loader (); 00044 00045 /// Open a file and perform preliminary validation to determine whether 00046 /// the file is complete and valid. 00047 bool open (const ACE_TString & file_name); 00048 00049 /////////////////////////////////// 00050 // Override Topology_Loader methods 00051 // see Topology_Loader.h for documentation 00052 virtual void load (Topology_Object *root); 00053 00054 00055 ///////////////////////////////////////// 00056 // Override ACEXML_DefaultHandler methods 00057 00058 virtual void startElement (const ACEXML_Char* namespaceURI, 00059 const ACEXML_Char* localName, 00060 const ACEXML_Char* qName, 00061 ACEXML_Attributes* atts ACEXML_ENV_ARG_DECL); 00062 00063 virtual void endElement (const ACEXML_Char*, 00064 const ACEXML_Char*, 00065 const ACEXML_Char* name ACEXML_ENV_ARG_DECL_NOT_USED); 00066 00067 private: 00068 /// The name of the file from which data is read. 00069 ACE_TString file_name_; 00070 /// A stream representing our current output. 00071 FILE * input_; 00072 00073 typedef ACE_Unbounded_Stack<Topology_Object*> TopoStack; 00074 TopoStack object_stack_; 00075 /// if false, then we're just checking syntax of topology file. 00076 bool live_; 00077 }; 00078 00079 } // namespace TAO_Notify 00080 00081 TAO_END_VERSIONED_NAMESPACE_DECL 00082 00083 #include /**/ "ace/post.h" 00084 #endif /* XML_LOADER_H */