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

SoapParserExpat.h

00001 /*
00002  *   Copyright 2003-2004 The Apache Software Foundation.
00003  *
00004  *   Licensed under the Apache License, Version 2.0 (the "License");
00005  *   you may not use this file except in compliance with the License.
00006  *   You may obtain a copy of the License at
00007  *
00008  *       http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *   Unless required by applicable law or agreed to in writing, software
00011  *   distributed under the License is distributed on an "AS IS" BASIS,
00012  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *   See the License for the specific language governing permissions and
00014  *   limitations under the License.
00015  */
00016 
00017 /*
00018  * @author Susantha Kumara (skumara@virtusa.com)
00019  *
00020  */
00021 #ifdef WIN32
00022 #pragma warning (disable : 4786)
00023 #endif
00024 
00025 #if !defined(__SoapParserExpat_H_INCLUDED__)
00026 #define __SoapParserExpat_H_INCLUDED__
00027 
00028 #include <expat/expat.h>
00029 #include <axis/server/Packet.h>
00030 
00031 #include "../xml/QName.h"
00032 #include <axis/server/AnyElement.h>
00033 #include "../xml/Event.h"
00034 #include <axis/server/XMLParser.h>
00035 
00036 #include <queue>
00037 #include <map>
00038 #include <string>
00039 
00040 using namespace std;
00041 
00042 class SoapParserExpat: public XMLParser
00043 {
00044 private:
00045     XML_Parser m_Parser;
00046     const Ax_soapstream* m_pInputStream;
00047     const char* m_pCurrentBuffer;
00048     Event* m_pLastEvent;
00049     AnyElement m_Element;
00050     queue<Event*> m_Events;
00051     map<AxisXMLString, AxisXMLString> m_NsStack;
00052     int m_nStatus;
00053     AXIS_TRANSPORT_STATUS m_nTransportStatus;
00054 public:
00055     SoapParserExpat();
00056     ~SoapParserExpat();
00057 private:
00058     void startElement(const XML_Ch *qname,const XML_Ch **attrs);
00059     void endElement(const XML_Ch *qname);
00060     void characters(const XML_Ch *chars,int length);
00061     void startPrefixMapping(const XML_Ch *prefix, const XML_Ch *uri);
00062     void endPrefixMapping(const XML_Ch *prefix);
00063     int ParseNext();
00064 
00065     inline static void XMLCALL s_startElement(void* p, const XML_Ch *qname,
00066         const XML_Ch **attrs)
00067     {((SoapParserExpat*)p)->startElement(qname,attrs);};
00068     inline static void XMLCALL s_endElement(void* p, const XML_Ch *qname)
00069     {((SoapParserExpat*)p)->endElement(qname);};
00070     inline static void XMLCALL s_characters(void* p, const XML_Ch *chars,
00071         int length)
00072     {((SoapParserExpat*)p)->characters(chars,length);};
00073     inline static void XMLCALL s_startPrefixMapping(void* p,
00074         const XML_Ch *prefix, const XML_Ch *uri)
00075     {((SoapParserExpat*)p)->startPrefixMapping(prefix, uri);};
00076     inline static void XMLCALL s_endPrefixMapping(void* p,
00077         const XML_Ch *prefix)
00078     {((SoapParserExpat*)p)->endPrefixMapping(prefix);};
00079 
00080 public:
00081     int SetInputStream(const Ax_soapstream* pInputStream);
00082     const Ax_soapstream* GetInputStream(){return m_pInputStream;};
00083     int Init();
00084     const XML_Ch* GetNS4Prefix(const XML_Ch* prefix);
00085     int GetStatus();
00086     const AnyElement* Next();
00087     AXIS_TRANSPORT_STATUS GetTransportStatus(){ return m_nTransportStatus;};
00088     void SetTransportStatus(AXIS_TRANSPORT_STATUS nStatus)
00089     { m_nTransportStatus = nStatus;};
00090 };
00091 
00092 #endif

Generated on Fri Apr 9 12:21:29 2004 for axiscpp by doxygen1.2.18