it_bus_pdk/xml_sax_attribute_impl.h

00001 #ifndef _IT_BUS_PDK_XML_SAX_ATTRIBUTE_IMPL_H_
00002 #define _IT_BUS_PDK_XML_SAX_ATTRIBUTE_IMPL_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 
00007 #include <xercesc/dom/DOM.hpp>
00008 #include <xercesc/sax2/Attributes.hpp>
00009 #include <it_bus/types.h>
00010 #include <it_dsa/vector.h>
00011 
00012 XERCES_CPP_NAMESPACE_USE
00013 
00014 namespace IT_Bus
00015 {
00016 
00017     // This class provides an internal-only custom implementation of
00018     // the SAX Attribute interface, as the existing SAX implementation
00019     // (VecAttributesImpl) requires that the XML document already be
00020     // parsed by SAX, whereas all we need is a simple representation of
00021     // DOM Attributes within the SAX framework.
00022     //
00023     // Note that some of the function names used in this class do not 
00024     // conform to the IONA style guidelines because this class must
00025     // override some pure virtual SAX-provided functions that use a 
00026     // different style.
00027     //
00028     class IT_SaxAttributesImpl : public Attributes
00029     {   
00030       public:
00031 
00032         IT_SaxAttributesImpl();
00033 
00034         ~IT_SaxAttributesImpl();
00035 
00036         // Attributes overrides
00037         //
00038         unsigned int 
00039         getLength() const;
00040 
00041         const XMLCh* 
00042         getURI(
00043             const unsigned int index
00044         ) const;
00045 
00046         const XMLCh* 
00047         getLocalName(
00048             const unsigned int index
00049         ) const;
00050 
00051         const XMLCh* 
00052         getQName(
00053             const unsigned int index
00054         ) const;
00055         
00056         const XMLCh* 
00057         getType(
00058             const unsigned int index
00059         ) const;
00060 
00061         const XMLCh* 
00062         getValue(
00063             const unsigned int index
00064         ) const;
00065 
00066         int 
00067         getIndex(
00068             const XMLCh* const uri, 
00069             const XMLCh* const localPart
00070         ) const;
00071         
00072         int 
00073         getIndex(
00074             const XMLCh* const qName
00075         ) const;
00076 
00077         const XMLCh* 
00078         getType(
00079             const XMLCh* const uri, 
00080             const XMLCh* const localPart
00081         ) const;
00082         
00083         const XMLCh* 
00084         getType(
00085             const XMLCh* const qName
00086         ) const;
00087 
00088         const XMLCh* 
00089         getValue(
00090             const XMLCh* const qName
00091         ) const;
00092         
00093         const XMLCh* 
00094         getValue(
00095             const XMLCh* const uri, 
00096             const XMLCh* const localPart
00097         ) const;
00098 
00099         // Custom methods
00100 
00101         void
00102         add_attribute(
00103             const XMLCh* const name,        
00104             const XMLCh* const value,
00105             const XMLCh* const prefix,
00106             const XMLCh* const uri
00107         );
00108 
00109       private:
00110           
00111         struct SimpleXMLAttribute
00112         {
00113             SimpleXMLAttribute(
00114                 const XMLCh* const local_name,
00115                 const XMLCh* const value,
00116                 const XMLCh* const prefix,
00117                 const XMLCh* const uri
00118             );
00119             
00120             ~SimpleXMLAttribute();
00121 
00122             XMLCh*      m_local_name;       
00123             XMLCh*      m_value;
00124             XMLCh*      m_prefix;
00125             XMLCh*      m_uri;
00126             XMLCh*      m_qname;
00127         };
00128 
00129         IT_Vector<SimpleXMLAttribute*> m_attributes;
00130     };
00131 }
00132 
00133 #endif  

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