SAXContentHandlerImpl.cpp
上传用户:quanyou
上传日期:2022-06-07
资源大小:39k
文件大小:4k
源码类别:

xml/soap/webservice

开发平台:

Visual C++

  1. // SAXContentHandlerImpl.cpp: implementation class for ISAXDeclHandler interface
  2. #include "stdafx.h"
  3. #include "SAXContentHandlerImpl.h"
  4. ///////////////////////////////////////////////////////////////////////////////
  5. // Construction/Destruction
  6. ///////////////////////////////////////////////////////////////////////////////
  7. SAXContentHandlerImpl::SAXContentHandlerImpl()
  8. {
  9. m_refCnt=0;
  10. }
  11. SAXContentHandlerImpl::~SAXContentHandlerImpl()
  12. {
  13. }
  14. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::putDocumentLocator( 
  15.             /* [in] */ ISAXLocator __RPC_FAR *pLocator
  16.             )
  17. {
  18.     return S_OK;
  19. }
  20.         
  21. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::startDocument()
  22. {
  23.     return S_OK;
  24. }
  25.         
  26.         
  27. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::endDocument( void)
  28. {
  29.     return S_OK;
  30. }
  31.         
  32.         
  33. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::startPrefixMapping( 
  34.             /* [in] */ wchar_t __RPC_FAR *pwchPrefix,
  35.             /* [in] */ int cchPrefix,
  36.             /* [in] */ wchar_t __RPC_FAR *pwchUri,
  37.             /* [in] */ int cchUri)
  38. {
  39.     return S_OK;
  40. }
  41.         
  42.         
  43. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::endPrefixMapping( 
  44.             /* [in] */ wchar_t __RPC_FAR *pwchPrefix,
  45.             /* [in] */ int cchPrefix)
  46. {
  47.     return S_OK;
  48. }
  49.         
  50.         
  51. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::startElement( 
  52.             /* [in] */ wchar_t __RPC_FAR *pwchNamespaceUri,
  53.             /* [in] */ int cchNamespaceUri,
  54.             /* [in] */ wchar_t __RPC_FAR *pwchLocalName,
  55.             /* [in] */ int cchLocalName,
  56.             /* [in] */ wchar_t __RPC_FAR *pwchRawName,
  57.             /* [in] */ int cchRawName,
  58.             /* [in] */ ISAXAttributes __RPC_FAR *pAttributes)
  59. {
  60.     return S_OK;
  61. }
  62.         
  63.        
  64. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::endElement( 
  65.             /* [in] */ wchar_t __RPC_FAR *pwchNamespaceUri,
  66.             /* [in] */ int cchNamespaceUri,
  67.             /* [in] */ wchar_t __RPC_FAR *pwchLocalName,
  68.             /* [in] */ int cchLocalName,
  69.             /* [in] */ wchar_t __RPC_FAR *pwchRawName,
  70.             /* [in] */ int cchRawName)
  71. {
  72.     return S_OK;
  73. }
  74.         
  75. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::characters( 
  76.             /* [in] */ wchar_t __RPC_FAR *pwchChars,
  77.             /* [in] */ int cchChars)
  78. {
  79.     return S_OK;
  80. }
  81.         
  82. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::ignorableWhitespace( 
  83.             /* [in] */ wchar_t __RPC_FAR *pwchChars,
  84.             /* [in] */ int cchChars)
  85. {
  86.     return S_OK;
  87. }
  88.         
  89. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::processingInstruction( 
  90.             /* [in] */ wchar_t __RPC_FAR *pwchTarget,
  91.             /* [in] */ int cchTarget,
  92.             /* [in] */ wchar_t __RPC_FAR *pwchData,
  93.             /* [in] */ int cchData)
  94. {
  95.     return S_OK;
  96. }
  97.         
  98.         
  99. HRESULT STDMETHODCALLTYPE SAXContentHandlerImpl::skippedEntity( 
  100.             /* [in] */ wchar_t __RPC_FAR *pwchVal,
  101.             /* [in] */ int cchVal)
  102. {
  103.     return S_OK;
  104. }
  105. long __stdcall SAXContentHandlerImpl::QueryInterface(const struct _GUID &riid,void ** ppvObject)
  106. {
  107.     *ppvObject = NULL;
  108. if (riid == IID_IUnknown ||riid == __uuidof(ISAXContentHandler))
  109. {
  110. *ppvObject = static_cast<ISAXContentHandler *>(this);
  111. }
  112. if (*ppvObject)
  113. {
  114. AddRef();
  115. return S_OK;
  116. }
  117. else return E_NOINTERFACE;
  118. }
  119. unsigned long __stdcall SAXContentHandlerImpl::AddRef()
  120. {
  121.      return ++m_refCnt; // NOT thread-safe
  122. }
  123. unsigned long __stdcall SAXContentHandlerImpl::Release()
  124. {
  125.     --m_refCnt; // NOT thread-safe
  126.    if (m_refCnt == 0) {
  127.       delete this;
  128.       return 0; // Can't return the member of a deleted object.
  129.    }
  130.    else return m_refCnt;
  131. }