it_bus_pdk/xml_stream_node.h

00001 #ifndef _IT_BUS_PDK_XML_STREAM_NODE_H_
00002 #define _IT_BUS_PDK_XML_STREAM_NODE_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 
00007 #include <it_dsa/vector.h>
00008 #include <it_bus/string_map.h>
00009 #include <it_bus/types.h>
00010 #include <it_bus/qname.h>
00011 #include <it_bus/deserialization_exception.h>
00012 #include <it_bus_pdk/xml_node.h>
00013 #include <it_bus_pdk/simple_pool.h>
00014 #include <it_bus/api_defines.h>
00015 #include "attribute.h"
00016 
00017 namespace IT_Bus
00018 {
00019     class XMLStreamNode;
00020     class XMLStreamNodeIterator;
00021     class XMLStreamNodeFactory;
00022 
00023     typedef StringMap<XMLStreamNode *> IdToXMLStreamNodeMap;
00024     typedef SimplePool<XMLStreamNode,XMLStreamNodeFactory> XMLStreamNodePool;
00025 
00026     class IT_BUS_XML_API XMLStreamNode : public XMLNode
00027     {
00028       public:
00029 
00030         XMLStreamNode();
00031 
00032         XMLStreamNode(
00033             IdToXMLStreamNodeMap& id_element_map,
00034             XMLStreamNodePool& node_pool
00035         );
00036 
00037         XMLStreamNode(
00038             IdToXMLStreamNodeMap& id_element_map
00039         );
00040 
00041         virtual ~XMLStreamNode();
00042 
00043         XMLStreamNode &
00044         operator = (
00045             const XMLStreamNode& rhs
00046         );
00047 
00048         XMLStreamNode(
00049             const XMLStreamNode& rhs
00050         );
00051 
00052         virtual const QNameRef &
00053         get_xsi_type();
00054 
00055         virtual void
00056         get_value(
00057             String & result
00058         );
00059 
00060         const String&
00061         get_href() const;
00062 
00063         void
00064         visited();
00065 
00066         void
00067         unvisit();
00068 
00069         bool
00070         is_visited() const;
00071 
00072         bool
00073         is_attribute_visited(
00074             const QName & attribute_qname
00075         ) const;
00076 
00077         virtual const IT_Vector<Attribute *> &
00078         get_attributes() const;
00079 
00080         virtual void
00081         get_attribute_value(
00082             const QName & attribute_qname,
00083             String & value
00084         ) const;
00085 
00086         virtual unsigned int
00087         get_child_count();
00088 
00089         virtual XMLStreamNode *
00090         get_child(
00091             unsigned int idx
00092         );
00093 
00094         virtual XMLStreamNodeIterator
00095         get_child_elements();
00096 
00097         virtual XMLSaxHandler *
00098         sax_start_element(
00099             const char * raw_name,
00100             const char * namespace_uri,
00101             const char * target_namespace
00102         );
00103 
00104         virtual bool
00105         sax_accept_attribute(
00106             char * raw_name,
00107             char * namespace_uri,
00108             const String& value
00109         );
00110 
00111 
00112         virtual void
00113         sax_accept_characters(
00114             const String::UChar* uchars,
00115             size_t               n = String::npos
00116         );
00117 
00123         void
00124         write(
00125             XMLOutputStream&         stream
00126         );
00127 
00136         virtual void
00137         write(
00138             XMLOutputStream&         stream,
00139             NamespaceURIPrefixMap&   current_serialized_prefixes
00140         );
00141 
00147         virtual void
00148         write_attributes(
00149             IT_Bus::XMLOutputStream&  stream
00150         ) const IT_THROW_DECL((IOException));
00151 
00160         virtual void
00161         write_attributes_with_prefix_map(
00162             IT_Bus::XMLOutputStream&  stream,
00163             NamespaceURIPrefixMap&    current_serialized_prefixes
00164         ) const IT_THROW_DECL((IOException));
00165 
00166         void
00167         clear() ; 
00168 
00169       protected:
00170 
00171         static bool 
00172         is_a_schema_instance_namespace_uri(
00173             const char* namespace_uri
00174         );
00175 
00176 
00177         IT_Vector<XMLStreamNode *>  m_children;
00178         IT_Vector<Attribute *>      m_attributes;
00179         XercesQNameRef*             m_xsi_type;
00180         IdToXMLStreamNodeMap*       m_id_element_map;
00181         String                      m_value;
00182         bool                        m_visited;
00183         bool                        m_href;
00184 
00185         XMLStreamNodePool*          m_node_pool;
00186     };
00187 
00188     class IT_BUS_XML_API XMLStreamNodeFactory
00189     {
00190       public:
00191 
00192         XMLStreamNodeFactory(
00193             IdToXMLStreamNodeMap & id_element_map,
00194             XMLStreamNodePool & node_pool
00195         );
00196 
00197         XMLStreamNodeFactory(
00198             const XMLStreamNodeFactory& rhs
00199         );
00200 
00201         XMLStreamNode*
00202         new_instance();
00203 
00204         void
00205         destroy(
00206             XMLStreamNode* node
00207         );
00208 
00209       private:
00210 
00211         IdToXMLStreamNodeMap &      m_id_element_map;
00212         XMLStreamNodePool &         m_node_pool;
00213     };
00214 
00215 }
00216 
00217 #endif  

Generated on Thu Sep 7 11:39:37 2006 for Artix by  doxygen 1.4.7