00001
00002 #ifndef __VemusSessionAttribs_H
00003 #define __VemusSessionAttribs_H
00004
00005
00006
00007
00008 #include <stdio.h>
00009 #include <tchar.h>
00010 #include <objbase.h>
00011
00012 #include <comdef.h>
00013
00014
00015
00016 #include <vector>
00017 #include <string>
00018 using namespace std;
00019 struct AttributePair
00020 {
00021 wstring value;
00022 wstring param[10];
00023
00024
00025
00026
00027
00028
00029
00030
00031 };
00032
00033 typedef vector<AttributePair, allocator<AttributePair> > AttribVector;
00034
00035
00036
00037
00038
00039 class MyContent : public ISAXContentHandler
00040 {
00041 public:
00042 MyContent::MyContent( vector <wstring> params);
00043
00044 virtual ~MyContent();
00045
00046
00047
00048 long __stdcall QueryInterface(const struct _GUID &riid,void ** ppvObject)
00049 {
00050 return 0;
00051 }
00052
00053 unsigned long __stdcall AddRef()
00054 {
00055 return 0;
00056 }
00057
00058 unsigned long __stdcall Release()
00059 {
00060 return 0;
00061 }
00062
00063
00064 virtual HRESULT __stdcall endElement (
00065 unsigned short * pwchNamespaceUri,
00066 int cchNamespaceUri,
00067 unsigned short * pwchLocalName,
00068 int cchLocalName,
00069 unsigned short * pwchQName,
00070 int cchQName );
00071
00072 HRESULT __stdcall startElement (
00073 unsigned short * pwchNamespaceUri,
00074 int cchNamespaceUri,
00075 unsigned short * pwchLocalName,
00076 int cchLocalName,
00077 unsigned short * pwchQName,
00078 int cchQName,
00079 struct ISAXAttributes * pAttributes );
00080
00081
00082 virtual HRESULT STDMETHODCALLTYPE startDocument();
00083
00084
00085
00086 virtual HRESULT STDMETHODCALLTYPE putDocumentLocator(
00087 ISAXLocator __RPC_FAR *pLocator){return 0L;};
00088
00089
00090 virtual HRESULT STDMETHODCALLTYPE endDocument( void);
00091
00092
00093 virtual HRESULT STDMETHODCALLTYPE MyContent::startPrefixMapping(unsigned short *,int,unsigned short *,int)
00094 {
00095 return 0;
00096 }
00097
00098
00099 virtual HRESULT __stdcall endPrefixMapping (
00100 unsigned short * pwchPrefix,
00101 int cchPrefix ){ return 0;};
00102
00103
00104
00105
00106
00107
00108
00109
00110 virtual HRESULT __stdcall characters (
00111 unsigned short * pwchChars,
00112 int cchChars )
00113 {
00114
00115
00116 _bstr_t test2 = pwchChars;
00117
00118 if( m_bInsideAttribs )
00119 {
00120
00121
00122 wchar_t * s = new wchar_t[cchChars+1];
00123 memset( s, 0, (cchChars+1)*sizeof(wchar_t) );
00124 memcpy( s, pwchChars, cchChars*sizeof(wchar_t) );
00125
00126
00127
00128 m_attribute.value = s;
00129
00130 _bstr_t test = s;
00131
00132 delete [] s;
00133
00134
00135
00136 }
00137
00138
00139 return 0L;
00140 }
00141
00142
00143 virtual HRESULT __stdcall ignorableWhitespace (
00144 unsigned short * pwchChars,
00145 int cchChars )
00146 {
00147 return 0;
00148 }
00149
00150
00151 virtual HRESULT __stdcall processingInstruction (
00152 unsigned short * pwchTarget,
00153 int cchTarget,
00154 unsigned short * pwchData,
00155 int cchData )
00156 {
00157 return 0L;
00158 }
00159
00160
00161 virtual HRESULT __stdcall skippedEntity (
00162 unsigned short * pwchName,
00163 int cchName )
00164 {
00165 return 0;
00166 }
00167
00168
00169
00170
00171
00172
00173 void print()
00174 {
00175 for( int i=0; i<m_attribs.size();i++ )
00176 {
00177
00178
00179 }
00180 }
00181
00182
00183 AttribVector * getResults(){ return &m_attribs; };
00184
00185 private:
00186 void prt(
00187 const wchar_t * pwchFmt,
00188 const wchar_t __RPC_FAR *pwchVal,
00189 int cchVal);
00190 int idnt;
00191
00192
00193
00194
00195
00196
00197 AttribVector m_attribs;
00198 AttributePair m_attribute;
00199 BOOL m_bInsideAttribs;
00200 public:
00201 vector <wstring> m_wsParams;
00202
00203
00204
00205
00206
00207
00208 AttribVector* getAttributes(){ return &m_attribs;};
00209 };
00210
00212
00213 bool ParseSessionXML( vector <wstring> params, const wchar_t * pwzSessionXML , AttribVector * pResults);
00214
00215
00216
00217
00218
00219
00220
00221
00222 #endif