From 9c84aa8c2c18b3eee493228e95535999c16f9393 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov <borisk@apache.org> Date: Fri, 14 Mar 2008 13:29:22 +0000 Subject: [PATCH] Move unused COM wrappers git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@637091 13f79535-47bb-0310-9956-ffa450edef68 --- src/xercesc/com/BindStatusCallback.cpp | 155 -- src/xercesc/com/BindStatusCallback.h | 65 - src/xercesc/com/IXMLDOMCharacterDataImpl.h | 188 -- src/xercesc/com/IXMLDOMNodeImpl.h | 139 -- src/xercesc/com/IXMLDOMNodeImpl.inl | 977 ---------- src/xercesc/com/IXMLDOMTextImpl.h | 63 - src/xercesc/com/NodeContainerImpl.h | 163 -- src/xercesc/com/README.txt | 44 - src/xercesc/com/StdAfx.cpp | 30 - src/xercesc/com/StdAfx.h | 81 - src/xercesc/com/XMLDOMAttribute.cpp | 149 -- src/xercesc/com/XMLDOMAttribute.h | 76 - src/xercesc/com/XMLDOMCDATASection.h | 64 - src/xercesc/com/XMLDOMComment.h | 63 - src/xercesc/com/XMLDOMDocument.cpp | 1598 ----------------- src/xercesc/com/XMLDOMDocument.h | 169 -- src/xercesc/com/XMLDOMDocumentFragment.h | 63 - src/xercesc/com/XMLDOMDocumentType.cpp | 133 -- src/xercesc/com/XMLDOMDocumentType.h | 67 - src/xercesc/com/XMLDOMElement.cpp | 341 ---- src/xercesc/com/XMLDOMElement.h | 74 - src/xercesc/com/XMLDOMEntity.cpp | 115 -- src/xercesc/com/XMLDOMEntity.h | 66 - src/xercesc/com/XMLDOMEntityReference.h | 62 - src/xercesc/com/XMLDOMImplementation.cpp | 46 - src/xercesc/com/XMLDOMImplementation.h | 53 - src/xercesc/com/XMLDOMNamedNodeMap.cpp | 342 ---- src/xercesc/com/XMLDOMNamedNodeMap.h | 73 - src/xercesc/com/XMLDOMNodeList.cpp | 174 -- src/xercesc/com/XMLDOMNodeList.h | 67 - src/xercesc/com/XMLDOMNotation.cpp | 94 - src/xercesc/com/XMLDOMNotation.h | 66 - src/xercesc/com/XMLDOMParseError.cpp | 167 -- src/xercesc/com/XMLDOMParseError.h | 88 - .../com/XMLDOMProcessingInstruction.cpp | 97 - src/xercesc/com/XMLDOMProcessingInstruction.h | 67 - src/xercesc/com/XMLDOMText.h | 63 - src/xercesc/com/XMLDOMUtil.cpp | 937 ---------- src/xercesc/com/XMLDOMUtil.h | 37 - src/xercesc/com/XMLDOMXMLDecl.cpp | 78 - src/xercesc/com/XMLDOMXMLDecl.h | 63 - src/xercesc/com/XMLHTTPRequest.cpp | 1096 ----------- src/xercesc/com/XMLHttpRequest.h | 128 -- src/xercesc/com/registry.bin | 0 src/xercesc/com/resource.h | 39 - src/xercesc/com/xml4com.cpp | 302 ---- src/xercesc/com/xml4com.def | 9 - src/xercesc/com/xml4com.idl | 106 -- src/xercesc/com/xml4com.rc | 121 -- src/xercesc/com/xml4comCP.h | 77 - src/xercesc/com/xml4comps.def | 11 - src/xercesc/com/xml4comps.mk | 16 - src/xercesc/com/xmldocument.rgs | 26 - src/xercesc/com/xmlhttprequest.rgs | 26 - 54 files changed, 9414 deletions(-) delete mode 100644 src/xercesc/com/BindStatusCallback.cpp delete mode 100644 src/xercesc/com/BindStatusCallback.h delete mode 100644 src/xercesc/com/IXMLDOMCharacterDataImpl.h delete mode 100644 src/xercesc/com/IXMLDOMNodeImpl.h delete mode 100644 src/xercesc/com/IXMLDOMNodeImpl.inl delete mode 100644 src/xercesc/com/IXMLDOMTextImpl.h delete mode 100644 src/xercesc/com/NodeContainerImpl.h delete mode 100644 src/xercesc/com/README.txt delete mode 100644 src/xercesc/com/StdAfx.cpp delete mode 100644 src/xercesc/com/StdAfx.h delete mode 100644 src/xercesc/com/XMLDOMAttribute.cpp delete mode 100644 src/xercesc/com/XMLDOMAttribute.h delete mode 100644 src/xercesc/com/XMLDOMCDATASection.h delete mode 100644 src/xercesc/com/XMLDOMComment.h delete mode 100644 src/xercesc/com/XMLDOMDocument.cpp delete mode 100644 src/xercesc/com/XMLDOMDocument.h delete mode 100644 src/xercesc/com/XMLDOMDocumentFragment.h delete mode 100644 src/xercesc/com/XMLDOMDocumentType.cpp delete mode 100644 src/xercesc/com/XMLDOMDocumentType.h delete mode 100644 src/xercesc/com/XMLDOMElement.cpp delete mode 100644 src/xercesc/com/XMLDOMElement.h delete mode 100644 src/xercesc/com/XMLDOMEntity.cpp delete mode 100644 src/xercesc/com/XMLDOMEntity.h delete mode 100644 src/xercesc/com/XMLDOMEntityReference.h delete mode 100644 src/xercesc/com/XMLDOMImplementation.cpp delete mode 100644 src/xercesc/com/XMLDOMImplementation.h delete mode 100644 src/xercesc/com/XMLDOMNamedNodeMap.cpp delete mode 100644 src/xercesc/com/XMLDOMNamedNodeMap.h delete mode 100644 src/xercesc/com/XMLDOMNodeList.cpp delete mode 100644 src/xercesc/com/XMLDOMNodeList.h delete mode 100644 src/xercesc/com/XMLDOMNotation.cpp delete mode 100644 src/xercesc/com/XMLDOMNotation.h delete mode 100644 src/xercesc/com/XMLDOMParseError.cpp delete mode 100644 src/xercesc/com/XMLDOMParseError.h delete mode 100644 src/xercesc/com/XMLDOMProcessingInstruction.cpp delete mode 100644 src/xercesc/com/XMLDOMProcessingInstruction.h delete mode 100644 src/xercesc/com/XMLDOMText.h delete mode 100644 src/xercesc/com/XMLDOMUtil.cpp delete mode 100644 src/xercesc/com/XMLDOMUtil.h delete mode 100644 src/xercesc/com/XMLDOMXMLDecl.cpp delete mode 100644 src/xercesc/com/XMLDOMXMLDecl.h delete mode 100644 src/xercesc/com/XMLHTTPRequest.cpp delete mode 100644 src/xercesc/com/XMLHttpRequest.h delete mode 100644 src/xercesc/com/registry.bin delete mode 100644 src/xercesc/com/resource.h delete mode 100644 src/xercesc/com/xml4com.cpp delete mode 100644 src/xercesc/com/xml4com.def delete mode 100644 src/xercesc/com/xml4com.idl delete mode 100644 src/xercesc/com/xml4com.rc delete mode 100644 src/xercesc/com/xml4comCP.h delete mode 100644 src/xercesc/com/xml4comps.def delete mode 100644 src/xercesc/com/xml4comps.mk delete mode 100644 src/xercesc/com/xmldocument.rgs delete mode 100644 src/xercesc/com/xmlhttprequest.rgs diff --git a/src/xercesc/com/BindStatusCallback.cpp b/src/xercesc/com/BindStatusCallback.cpp deleted file mode 100644 index 9e9e6d83e..000000000 --- a/src/xercesc/com/BindStatusCallback.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -// CBindStatCallback.cpp : Implementation of BindStatusCallback -#include "stdafx.h" -#include "resource.h" -#include "BindStatusCallback.h" -#include "xml4com.h" -#include "XMLDOMDocument.h" - -///////////////////////////////////////////////////////////////////////////// -// CBindStatCallback - -STDMETHODIMP CBindStatCallback::OnStartBinding(DWORD dwReserved, IBinding *pBinding) -{ - ATLTRACE(_T("CBindStatCallback::OnStartBinding\n")); - return S_OK; -} - -STDMETHODIMP CBindStatCallback::GetPriority(LONG *pnPriority) -{ - ATLTRACE(_T("CBindStatCallback::GetPriority\n")); - return E_NOTIMPL; -} - -STDMETHODIMP CBindStatCallback::OnLowResource(DWORD reserved) -{ - ATLTRACE(_T("CBindStatCallback::OnLowResource\n")); - return E_NOTIMPL; -} - -STDMETHODIMP CBindStatCallback::OnProgress(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) -{ - ATLTRACE(_T("CBindStatCallback::OnProgress %d %d\n"),ulProgress,ulProgressMax); - if (m_pDoc->IsAbort()) - return E_ABORT; - - _bstr_t text(szStatusText); - switch (ulStatusCode) { - case BINDSTATUS_FINDINGRESOURCE: - text = _T("Finding resource ") + text; - break; - case BINDSTATUS_CONNECTING: - text = _T("Connecting ") + text; - break; - case BINDSTATUS_REDIRECTING: - text = _T("Redirecting ") + text; - break; - case BINDSTATUS_BEGINDOWNLOADDATA: - text = _T("Begin to download data ") + text; - break; - case BINDSTATUS_DOWNLOADINGDATA: - text = _T("Downloading data ") + text; - break; - case BINDSTATUS_ENDDOWNLOADDATA: - text = _T("End of downloading data ") + text; - break; - case BINDSTATUS_BEGINDOWNLOADCOMPONENTS: - text = _T("Downloading components ") + text; - break; - case BINDSTATUS_INSTALLINGCOMPONENTS: - text = _T("Installing components ") + text; - break; - case BINDSTATUS_ENDDOWNLOADCOMPONENTS: - text = _T("End of downloading components ") + text; - break; - case BINDSTATUS_USINGCACHEDCOPY: - text = _T("Using cached copy ") + text; - break; - case BINDSTATUS_SENDINGREQUEST: - text = _T("Sending request ") + text; - break; - case BINDSTATUS_CLASSIDAVAILABLE: - text = _T("Classid available ") + text; - break; - case BINDSTATUS_MIMETYPEAVAILABLE: - text = _T("Mime type available ") + text; - break; - case BINDSTATUS_CACHEFILENAMEAVAILABLE: - text = _T("Cache file name available ") + text; - break; - case BINDSTATUS_BEGINSYNCOPERATION: - text = _T("Begin sync operation ") + text; - break; - case BINDSTATUS_ENDSYNCOPERATION: - text = _T("End of sync operation ") + text; - break; - case BINDSTATUS_BEGINUPLOADDATA: - text = _T("Begin uploading data ") + text; - break; - case BINDSTATUS_UPLOADINGDATA: - text = _T("Uploading data ") + text; - break; - case BINDSTATUS_PROTOCOLCLASSID: - text = _T("Protocol classid ") + text; - break; - case BINDSTATUS_ENCODING: - text = _T("Encoding ") + text; - break; - case BINDSTATUS_CLASSINSTALLLOCATION: - text = _T("Class intall location ") + text; - break; - case BINDSTATUS_DECODING: - text = _T("Decoding ") + text; - break; - default: - break; - } - - ATLTRACE(_T("CBindStatCallback::OnProgress %s\n"),text); - - return S_OK; -} - -STDMETHODIMP CBindStatCallback::OnStopBinding(HRESULT hresult, LPCWSTR szError) -{ - ATLTRACE(_T("CBindStatCallback::OnStopBinding\n")); - return S_OK; -} - -STDMETHODIMP CBindStatCallback::GetBindInfo(DWORD *pgrfBINDF, BINDINFO *pbindInfo) -{ - ATLTRACE(_T("CBindStatCallback::GetBindInfo\n")); - return E_NOTIMPL; -} - -STDMETHODIMP CBindStatCallback::OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed) -{ - ATLTRACE(_T("CBindStatCallback::OnDataAvailable\n")); - return E_NOTIMPL; -} - -STDMETHODIMP CBindStatCallback::OnObjectAvailable(REFIID riid, IUnknown *punk) -{ - ATLTRACE(_T("CBindStatCallback::OnObjectAvailable\n")); - return E_NOTIMPL; -} diff --git a/src/xercesc/com/BindStatusCallback.h b/src/xercesc/com/BindStatusCallback.h deleted file mode 100644 index d995d719a..000000000 --- a/src/xercesc/com/BindStatusCallback.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -// BindStatusCallback.h : Declaration of the BindStatCallback - -#ifndef ___bindstatuscallback_h___ -#define ___bindstatuscallback_h___ - -class CXMLDOMDocument; - -///////////////////////////////////////////////////////////////////////////// -// BindStatCallback -class ATL_NO_VTABLE CBindStatCallback : - public CComObjectRootEx<CComSingleThreadModel>, - public IBindStatusCallback -{ -public: - CBindStatCallback() - :m_pDoc(NULL) - { - } - -DECLARE_NOT_AGGREGATABLE(CBindStatCallback) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CBindStatCallback) - COM_INTERFACE_ENTRY(IBindStatusCallback) -END_COM_MAP() - -// IBindStatusCallback -public: - STDMETHOD(OnStartBinding)(DWORD dwReserved, IBinding *pBinding); - STDMETHOD(GetPriority)(LONG *pnPriority); - STDMETHOD(OnLowResource)(DWORD reserved); - STDMETHOD(OnProgress)(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText); - STDMETHOD(OnStopBinding)(HRESULT hresult, LPCWSTR szError); - STDMETHOD(GetBindInfo)(DWORD *pgrfBINDF, BINDINFO *pbindInfo); - STDMETHOD(OnDataAvailable)(DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed); - STDMETHOD(OnObjectAvailable)(REFIID riid, IUnknown *punk); - - CXMLDOMDocument *m_pDoc; -}; - -typedef CComObject<CBindStatCallback> CBindStatCallbackObj; - -#endif //___bindstatuscallback_h___ diff --git a/src/xercesc/com/IXMLDOMCharacterDataImpl.h b/src/xercesc/com/IXMLDOMCharacterDataImpl.h deleted file mode 100644 index b315ee8c0..000000000 --- a/src/xercesc/com/IXMLDOMCharacterDataImpl.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___ixmldomcharacterdataimpl_h___ -#define ___ixmldomcharacterdataimpl_h___ - -#include "IXMLDOMNodeImpl.h" -XERCES_CPP_NAMESPACE_USE - -template <class T, const IID* piid, class tihclass = CComTypeInfoHolder> -class ATL_NO_VTABLE IXMLDOMCharacterDataImpl: public IXMLDOMNodeImpl<T,piid,tihclass> -{ -public: - - virtual DOMCharacterData* get_DOMCharacterData() = 0; - virtual DOMNode* get_DOMNode() { return get_DOMCharacterData(); } - - // IXMLDOMCharacterData - -STDMETHOD(get_data)(BSTR *pVal) -{ - ATLTRACE(_T("IXMLDOMCharacterDataImpl::get_data\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(get_DOMCharacterData()->getData()); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHOD(put_data)(BSTR newVal) -{ - ATLTRACE(_T("IXMLDOMCharacterDataImpl::put_data\n")); - - try - { - get_DOMCharacterData()->setData(newVal); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHOD(get_length)(long *pVal) -{ - ATLTRACE(_T("IXMLDOMCharacterDataImpl::get_length\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = 0; - - try - { - *pVal = (long)get_DOMCharacterData()->getLength(); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHOD(substringData)(long offset, long count, BSTR *data) -{ - ATLTRACE(_T("IXMLDOMCharacterDataImpl::substringData\n")); - - if (NULL == data) - return E_POINTER; - - *data = NULL; - - try - { - *data = SysAllocString(get_DOMCharacterData()->substringData(offset, count)); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHOD(appendData)(BSTR data) -{ - ATLTRACE(_T("IXMLDOMCharacterDataImpl::appendData\n")); - - try - { - get_DOMCharacterData()->appendData(data); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHOD(insertData)(long offset, BSTR data) -{ - ATLTRACE(_T("IXMLDOMCharacterDataImpl::insertData\n")); - - try - { - get_DOMCharacterData()->insertData(offset, data); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHOD(deleteData)(long offset, long count) -{ - ATLTRACE(_T("IXMLDOMCharacterDataImpl::deleteData\n")); - - try - { - get_DOMCharacterData()->deleteData(offset, count); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHOD(replaceData)(long offset, long count, BSTR data) -{ - ATLTRACE(_T("IXMLDOMCharacterDataImpl::replaceData\n")); - - try - { - get_DOMCharacterData()->replaceData(offset, count, data); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -}; - -#endif // ___ixmldomcharacterdataimpl_h___ \ No newline at end of file diff --git a/src/xercesc/com/IXMLDOMNodeImpl.h b/src/xercesc/com/IXMLDOMNodeImpl.h deleted file mode 100644 index cc9ca5663..000000000 --- a/src/xercesc/com/IXMLDOMNodeImpl.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___ixmldomnodeimpl_h___ -#define ___ixmldomnodeimpl_h___ - -#include <xercesc/util/XercesDefs.hpp> -#include <xercesc/dom/DOMException.hpp> -XERCES_CPP_NAMESPACE_USE - - -// -// This macro is defined in MSXML.H's compatible with IE5 -// and not defined in those from IE4. -// -// To correct, install a IE5 or later version of the Microsoft Platform SDK -// and add \Program Files\Microsoft Platform SDK\Include as the first entry -// on the Directories tab on the dialog displayed after selecting Tools Options -// from the Visual Studio IDE. -// -// See http://xerces.apache.org/xerces-c/build.html#BuildCOM -#ifndef __IXMLDOMNode_INTERFACE_DEFINED__ -#error "xerces-dom requires an MSXML.H compatible with IE5 or later. See http://xerces.apache.org/xerces-c/build.html#BuildCOM for directions to correct this problem." -#endif - - -template <class T, const IID* piid, class tihclass = CComTypeInfoHolder> -class ATL_NO_VTABLE IXMLDOMNodeImpl: - public IDispatchImpl<T,piid,&LIBID_Xerces, XERCES_VERSION_MAJOR, INVK_CAT2_RAW_NUMERIC(XERCES_VERSION_MINOR,XERCES_VERSION_REVISION),tihclass>, - public IIBMXMLDOMNodeIdentity, - public ISupportErrorInfo -{ -public: - - IXMLDOMNodeImpl() - :m_pIXMLDOMDocument(NULL) - {} - - virtual DOMNode* get_DOMNode() = 0; - virtual DOMNodeType get_DOMNodeType() const = 0; - - void SetOwnerDoc(IXMLDOMDocument *p) - { - m_pIXMLDOMDocument = p; - if (m_pIXMLDOMDocument != NULL) - m_pIXMLDOMDocument->AddRef(); - } - - // IIBMXMLDOMNodeIdentity - STDMETHOD(get_NodeId)(long *pVal) - { - ATLTRACE(_T("IXMLDOMNodeImpl::get_NodeId\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = reinterpret_cast<long> (get_DOMNode()); - return S_OK; - } - - // ISupportErrorInfo - HRESULT STDMETHODCALLTYPE InterfaceSupportsErrorInfo(REFIID iid); - - - // IXMLDOMNode - STDMETHOD(get_nodeName)(BSTR *pVal); - STDMETHOD(get_nodeValue)(VARIANT *pVal); - STDMETHOD(put_nodeValue)(VARIANT newVal); - STDMETHOD(get_nodeType)(DOMNodeType *pVal); - STDMETHOD(get_parentNode)(IXMLDOMNode * *pVal); - STDMETHOD(get_childNodes)(IXMLDOMNodeList * *pVal); - STDMETHOD(get_firstChild)(IXMLDOMNode * *pVal); - STDMETHOD(get_lastChild)(IXMLDOMNode * *pVal); - STDMETHOD(get_previousSibling)(IXMLDOMNode * *pVal); - STDMETHOD(get_nextSibling)(IXMLDOMNode * *pVal); - STDMETHOD(get_attributes)(IXMLDOMNamedNodeMap * *pVal); - STDMETHOD(insertBefore)(IXMLDOMNode *newChild, VARIANT refChild, IXMLDOMNode * *outNewChild); - STDMETHOD(replaceChild)(IXMLDOMNode *newChild, IXMLDOMNode *oldChild, IXMLDOMNode * *outNewChild); - STDMETHOD(removeChild)(IXMLDOMNode *childNode, IXMLDOMNode * *oldChild); - STDMETHOD(appendChild)(IXMLDOMNode *newChild, IXMLDOMNode * *outNewChild); - STDMETHOD(hasChildNodes)(VARIANT_BOOL *hasChild); - STDMETHOD(get_ownerDocument)(IXMLDOMDocument * *pVal); - STDMETHOD(cloneNode)(VARIANT_BOOL deep, IXMLDOMNode * *cloneRoot); - STDMETHOD(get_nodeTypeString)(BSTR *pVal); - STDMETHOD(get_text)(BSTR *pVal); - STDMETHOD(put_text)(BSTR newVal); - STDMETHOD(get_specified)(VARIANT_BOOL *pVal); - STDMETHOD(get_definition)(IXMLDOMNode * *pVal); - STDMETHOD(get_nodeTypedValue)(VARIANT *pVal); - STDMETHOD(put_nodeTypedValue)(VARIANT newVal); - STDMETHOD(get_dataType)(VARIANT *pVal); - STDMETHOD(put_dataType)(BSTR dataTypeName); - STDMETHOD(get_xml)(BSTR *pVal); - STDMETHOD(transformNode)(IXMLDOMNode *stylesheet, BSTR *xmlString); - STDMETHOD(selectNodes)(BSTR queryString, IXMLDOMNodeList * *resultList); - STDMETHOD(selectSingleNode)(BSTR queryString, IXMLDOMNode * *resultNode); - STDMETHOD(get_parsed)(VARIANT_BOOL *pVal); - STDMETHOD(get_namespaceURI)(BSTR *pVal); - STDMETHOD(get_prefix)(BSTR *pVal); - STDMETHOD(get_baseName)(BSTR *pVal); - STDMETHOD(transformNodeToObject)(IXMLDOMNode *stylesheet, VARIANT outputObject); - -protected: - - IXMLDOMDocument *m_pIXMLDOMDocument; - - void ReleaseOwnerDoc() - { - if (m_pIXMLDOMDocument != NULL) { - m_pIXMLDOMDocument->Release(); - m_pIXMLDOMDocument = NULL; - } - } - -}; - -HRESULT MakeHRESULT(DOMException& ex); - -#include "IXMLDOMNodeImpl.inl" - -#endif // ___ixmldomnodeimpl_h___ diff --git a/src/xercesc/com/IXMLDOMNodeImpl.inl b/src/xercesc/com/IXMLDOMNodeImpl.inl deleted file mode 100644 index eb4b02c3e..000000000 --- a/src/xercesc/com/IXMLDOMNodeImpl.inl +++ /dev/null @@ -1,977 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - - -#include <xercesc/dom/DOMNode.hpp> -#include <xercesc/dom/DOMDocument.hpp> -#include <xercesc/dom/DOMText.hpp> -#include "XMLDOMNodeList.h" -#include "XMLDOMNamedNodeMap.h" -#include "XMLDOMUtil.h" -#include <xercesc/dom/DOMException.hpp> - -XERCES_CPP_NAMESPACE_USE - -template <class T, const IID* piid, class tihclass> -HRESULT STDMETHODCALLTYPE IXMLDOMNodeImpl<T,piid,tihclass>::InterfaceSupportsErrorInfo(REFIID riid) -{ - if(riid == *piid) return S_OK; - return S_FALSE; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_nodeName(BSTR *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_nodeName\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(get_DOMNode()->getNodeName()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_nodeValue(VARIANT *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_nodeValue\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - - - try - { - const XMLCh* val=get_DOMNode()->getNodeValue(); - if (val != 0) - { - V_VT(pVal) = VT_BSTR; - V_BSTR(pVal) = SysAllocString(val); - } - else - V_VT(pVal) = VT_NULL; - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::put_nodeValue(VARIANT newVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::put_nodeValue\n")); - - try - { - if(V_VT(&newVal) == VT_BSTR) - { - get_DOMNode()->setNodeValue(V_BSTR(&newVal)); - } - // - // coerce to BSTR or throw error - // - else - { - get_DOMNode()->setNodeValue((BSTR) (_bstr_t) newVal); - } - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_nodeType(DOMNodeType *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_nodeType\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = get_DOMNodeType(); - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_parentNode(IXMLDOMNode **pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_parentNode\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - HRESULT hr = S_OK; - - try - { - DOMNode* n = get_DOMNode()->getParentNode(); - if(n!=NULL) { - hr = wrapNode(m_pIXMLDOMDocument, n,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - } - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_childNodes(IXMLDOMNodeList * *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_childNodes\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMNodeListObj *pObj = NULL; - HRESULT hr = CXMLDOMNodeListObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - - try - { - pObj->m_container = get_DOMNode()->getChildNodes(); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMNodeList, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_firstChild(IXMLDOMNode **pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_firstChild\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - HRESULT hr = S_OK; - - try - { - DOMNode* n = get_DOMNode()->getFirstChild(); - // - // returns Nothing if no children - // - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_lastChild(IXMLDOMNode **pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_lastChild\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - HRESULT hr = S_OK; - - try - { - DOMNode* n = get_DOMNode()->getLastChild(); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_previousSibling(IXMLDOMNode * *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_previousSibling\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - HRESULT hr = S_OK; - - try - { - DOMNode* n = get_DOMNode()->getPreviousSibling(); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_nextSibling(IXMLDOMNode * *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_nextSibling\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - HRESULT hr = S_OK; - - try - { - DOMNode* n = get_DOMNode()->getNextSibling(); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_attributes(IXMLDOMNamedNodeMap * *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_attributes\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - DOMNamedNodeMap* map=NULL; - try - { - map = get_DOMNode()->getAttributes(); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - if ((map == 0) || (NODE_ELEMENT != get_DOMNodeType())) - //&& - //NODE_ENTITY != get_DOMNodeType() && - //NODE_NOTATION != get_DOMNodeType()) - return S_OK; - - CXMLDOMNamedNodeMapObj *pObj = NULL; - HRESULT hr = CXMLDOMNamedNodeMapObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - pObj->m_container = map; - - hr = pObj->QueryInterface(IID_IXMLDOMNamedNodeMap, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::insertBefore(IXMLDOMNode *newChild, VARIANT refChild, IXMLDOMNode **outNewChild) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::insertBefore\n")); - - if (NULL == outNewChild) - return E_POINTER; - - *outNewChild = NULL; - - if (NULL == newChild) - return E_INVALIDARG; - - if (V_VT(&refChild) != VT_DISPATCH && V_VT(&refChild) != VT_NULL) - return E_INVALIDARG; - - if (V_VT(&refChild) == VT_NULL) - return appendChild(newChild,outNewChild); - - CComQIPtr<IIBMXMLDOMNodeIdentity,&IID_IIBMXMLDOMNodeIdentity> pNewChild(newChild); - if (!pNewChild) - return E_NOINTERFACE; - - long id = 0; - HRESULT hr = pNewChild->get_NodeId(&id); - if (S_OK != hr) - return hr; - - DOMNode *pNewChildNode = reinterpret_cast<DOMNode*> (id); - if (NULL == pNewChildNode) - return E_INVALIDARG; - - CComQIPtr<IIBMXMLDOMNodeIdentity,&IID_IIBMXMLDOMNodeIdentity> pRefChild(V_DISPATCH(&refChild)); - if (!pRefChild) - return E_NOINTERFACE; - - id = 0; - hr = pRefChild->get_NodeId(&id); - if (S_OK != hr) - return hr; - - DOMNode *pRefChildNode = reinterpret_cast<DOMNode*> (id); - if (NULL == pRefChildNode) - return E_INVALIDARG; - - try - { - DOMNode* n = get_DOMNode()->insertBefore(pNewChildNode, pRefChildNode); - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (outNewChild)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::replaceChild(IXMLDOMNode *newChild, IXMLDOMNode *oldChild, IXMLDOMNode * *outNewChild) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::replaceChild\n")); - - if (NULL == outNewChild) - return E_POINTER; - - *outNewChild = NULL; - - if (NULL == oldChild) - return E_INVALIDARG; - - if (NULL == newChild) - return removeChild(oldChild,outNewChild); - - - CComQIPtr<IIBMXMLDOMNodeIdentity,&IID_IIBMXMLDOMNodeIdentity> pNewChild(newChild); - if (!pNewChild) - return E_NOINTERFACE; - - long id = 0; - HRESULT hr = pNewChild->get_NodeId(&id); - if (S_OK != hr) - return hr; - - DOMNode *pNewChildNode = reinterpret_cast<DOMNode*> (id); - if (NULL == pNewChildNode) - return E_INVALIDARG; - - CComQIPtr<IIBMXMLDOMNodeIdentity,&IID_IIBMXMLDOMNodeIdentity> pOldChild(oldChild); - if (!pOldChild) - return E_NOINTERFACE; - - id = 0; - hr = pOldChild->get_NodeId(&id); - if (S_OK != hr) - return hr; - - DOMNode *pOldChildNode = reinterpret_cast<DOMNode*> (id); - if (NULL == pOldChildNode) - return E_INVALIDARG; - - try - { - DOMNode* n = get_DOMNode()->replaceChild(pNewChildNode, pOldChildNode); - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (outNewChild)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::removeChild(IXMLDOMNode *child, IXMLDOMNode * *oldChild) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::removeChild\n")); - - if (NULL == oldChild) - return E_POINTER; - - *oldChild = NULL; - - if (NULL == child) - return E_INVALIDARG; - - CComQIPtr<IIBMXMLDOMNodeIdentity,&IID_IIBMXMLDOMNodeIdentity> pChild(child); - if (!pChild) - return E_NOINTERFACE; - - long id = 0; - HRESULT hr = pChild->get_NodeId(&id); - if (S_OK != hr) - return hr; - - DOMNode *pChildNode = reinterpret_cast<DOMNode*> (id); - if (NULL == pChildNode) - return E_INVALIDARG; - - try - { - DOMNode* n = get_DOMNode()->removeChild(pChildNode); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (oldChild)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::appendChild(IXMLDOMNode *newChild, IXMLDOMNode * *outNewChild) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::appendChild\n")); - - if (NULL == outNewChild) - return E_POINTER; - - *outNewChild = NULL; - - if (NULL == newChild) - return E_INVALIDARG; - - CComQIPtr<IIBMXMLDOMNodeIdentity,&IID_IIBMXMLDOMNodeIdentity> pNewChild(newChild); - if (!pNewChild) - return E_NOINTERFACE; - - long id = 0; - HRESULT hr = pNewChild->get_NodeId(&id); - if (S_OK != hr) - return hr; - - DOMNode *pNewChildNode = reinterpret_cast<DOMNode*> (id); - if (NULL == pNewChildNode) - return E_INVALIDARG; - - try - { - DOMNode* n = get_DOMNode()->appendChild(pNewChildNode); - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (outNewChild)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::hasChildNodes(VARIANT_BOOL *hasChild) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::hasChildNodes\n")); - - if (NULL == hasChild) - return E_POINTER; - - *hasChild = VARIANT_FALSE; - - try - { - *hasChild = (get_DOMNode()->hasChildNodes()) ? VARIANT_TRUE : VARIANT_FALSE; - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_ownerDocument(IXMLDOMDocument **pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_ownerDocument\n")); - - if (NULL == pVal) - return E_POINTER; - *pVal = NULL; - - if (get_DOMNodeType() != NODE_DOCUMENT) - { - *pVal = m_pIXMLDOMDocument; - if (*pVal != NULL) - (*pVal)->AddRef(); - } - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::cloneNode(VARIANT_BOOL deep, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::cloneNode\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - HRESULT hr = S_OK; - - try - { - hr = wrapNode(m_pIXMLDOMDocument,get_DOMNode()->cloneNode((VARIANT_TRUE == deep) ? true : false),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return hr; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_nodeTypeString(BSTR *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_nodeTypeString\n")); - - USES_CONVERSION; - - if (NULL == pVal) - return E_POINTER; - - *pVal = ::SysAllocString(g_DomNodeName[get_DOMNodeType()]); - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_text(BSTR *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_text\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = SysAllocString(get_DOMNode()->getTextContent()); - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::put_text(BSTR newVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::put_text\n")); - - DOMNodeType type = get_DOMNodeType(); - if (NODE_DOCUMENT_FRAGMENT == type || - NODE_DOCUMENT_TYPE == type || - NODE_ENTITY == type || - NODE_ENTITY_REFERENCE == type || - NODE_NOTATION == type) - return E_ACCESSDENIED; - - try - { - if(NODE_ELEMENT == type) - { - // - // remove all child elements - // - DOMNode* elem = get_DOMNode(); - DOMNode* child = elem->getLastChild(); - while(child!=NULL) - { - elem->removeChild(child); - child = elem->getLastChild(); - } - - XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* doc = elem->getOwnerDocument(); - elem->appendChild(doc->createTextNode(newVal)); - } - else - get_DOMNode()->setNodeValue(newVal); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_specified(VARIANT_BOOL *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_specified\n")); - - *pVal = VARIANT_TRUE; - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_definition(IXMLDOMNode * *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_definition\n")); - - return E_NOTIMPL; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_nodeTypedValue(VARIANT *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_nodeTypedValue\n")); - - return get_nodeValue(pVal); -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::put_nodeTypedValue(VARIANT newVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::put_nodeTypedValue\n")); - - return put_nodeValue(newVal); -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_dataType(VARIANT *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_dataType\n")); - - return E_NOTIMPL; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::put_dataType(BSTR dataTypeName) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::put_dataType\n")); - - return E_NOTIMPL; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_xml(BSTR *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_xml\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - _bstr_t text; - - try { - GetXML(get_DOMNode(),text); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - *pVal = text.copy(); - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::transformNode(IXMLDOMNode *stylesheet, BSTR *xmlString) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::transformNode\n")); - - return E_NOTIMPL; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::selectNodes(BSTR queryString, IXMLDOMNodeList * *resultList) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::selectNodes\n")); - - return E_NOTIMPL; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::selectSingleNode(BSTR queryString, IXMLDOMNode * *resultNode) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::selectSingleNode\n")); - - return E_NOTIMPL; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_parsed(VARIANT_BOOL *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_parsed\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = VARIANT_TRUE; - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_namespaceURI(BSTR *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_namespaceURI\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try { - *pVal = SysAllocString(get_DOMNode()->getNamespaceURI()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_prefix(BSTR *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_prefix\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try { - *pVal = SysAllocString(get_DOMNode()->getPrefix()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::get_baseName(BSTR *pVal) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::get_baseName\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try { - *pVal = SysAllocString(get_DOMNode()->getLocalName()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -template <class T, const IID* piid, class tihclass> -STDMETHODIMP -IXMLDOMNodeImpl<T,piid,tihclass>::transformNodeToObject(IXMLDOMNode *stylesheet, VARIANT outputObject) -{ - ATLTRACE(_T("IXMLDOMNodeImpl::transformNodeToObject\n")); - - return E_NOTIMPL; -} - diff --git a/src/xercesc/com/IXMLDOMTextImpl.h b/src/xercesc/com/IXMLDOMTextImpl.h deleted file mode 100644 index 2051e5536..000000000 --- a/src/xercesc/com/IXMLDOMTextImpl.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___ixmldomtextimpl_h___ -#define ___ixmldomtextimpl_h___ - -#include "XMLDOMUtil.h" -#include "IXMLDOMCharacterDataImpl.h" - -template <class T, const IID* piid, class tihclass = CComTypeInfoHolder> -class ATL_NO_VTABLE IXMLDOMTextImpl: public IXMLDOMCharacterDataImpl<T,piid,tihclass> -{ -public: - - virtual DOMText* get_DOMText() = 0; - virtual DOMCharacterData* get_DOMCharacterData() { return get_DOMText(); } - - // IXMLDOMText - -STDMETHOD(splitText)(long offset, IXMLDOMText **rightHandTextNode) -{ - ATLTRACE(_T("IXMLDOMTextImpl::splitText\n")); - - if (NULL == rightHandTextNode) - return E_POINTER; - - *rightHandTextNode = NULL; - - HRESULT hr = S_OK; - - try - { - hr = wrapNode(m_pIXMLDOMDocument,get_DOMText()->splitText(offset),IID_IXMLDOMText, reinterpret_cast<LPVOID *> (rightHandTextNode)); - } - catch(...) - { - return E_FAIL; - } - - return hr; -} - -}; - -#endif // ___ixmldomtextimpl_h___ \ No newline at end of file diff --git a/src/xercesc/com/NodeContainerImpl.h b/src/xercesc/com/NodeContainerImpl.h deleted file mode 100644 index ba7cf188b..000000000 --- a/src/xercesc/com/NodeContainerImpl.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___nodecontainerimpl_h___ -#define ___nodecontainerimpl_h___ - -template <class T> -class NodeContainerImpl -{ -public: - - class iterator - { - public: - iterator() - :m_container(NULL) - ,m_NextNodeIndex(0) - ,m_pIXMLDOMDocument(NULL) - { - VariantInit(&m_NextVar); - V_VT(&m_NextVar) = VT_NULL; - } - - iterator(const T* container,int idx,IXMLDOMDocument *p) - :m_container(container) - ,m_NextNodeIndex(idx) - ,m_pIXMLDOMDocument(p) - { - VariantInit(&m_NextVar); - V_VT(&m_NextVar) = VT_NULL; - if (m_pIXMLDOMDocument != NULL) - m_pIXMLDOMDocument->AddRef(); - } - - ~iterator() - { - VariantClear(&m_NextVar); - if (m_pIXMLDOMDocument != NULL) - m_pIXMLDOMDocument->Release(); - } - - bool operator !=(const iterator& rhs) - { - return (m_NextNodeIndex != rhs.m_NextNodeIndex); - } - - iterator& operator=(const iterator& rhs) - { - if (this != &rhs) { - if (m_pIXMLDOMDocument != NULL) { - m_pIXMLDOMDocument->Release() ; - m_pIXMLDOMDocument = NULL ; - } - m_container = rhs.m_container ; - m_NextNodeIndex = rhs.m_NextNodeIndex ; - m_NextVar = rhs.m_NextVar ; - m_pIXMLDOMDocument = rhs.m_pIXMLDOMDocument ; - if (m_pIXMLDOMDocument != NULL) { - m_pIXMLDOMDocument->AddRef() ; - } - } - return *this ; - } - - - VARIANT& operator*() - { - if (m_container == 0) - return m_NextVar; - - int length = m_container->getLength(); - if (m_NextNodeIndex >= length) - return m_NextVar; - - CComPtr<IXMLDOMNode> pNode; - HRESULT hr = wrapNode(m_pIXMLDOMDocument,m_container->item(m_NextNodeIndex),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (&pNode)); - if (S_OK == hr) { - CComQIPtr<IDispatch,&IID_IDispatch> pDisp(pNode); - if (pNode) { - VariantClear(&m_NextVar); - V_VT(&m_NextVar) = VT_DISPATCH; - V_DISPATCH(&m_NextVar) = pDisp.Detach(); - } - } - - return m_NextVar; - } - - iterator operator++(int) - { - return iterator(m_container,m_NextNodeIndex++,m_pIXMLDOMDocument); - } - - private: - - const T* m_container; - int m_NextNodeIndex; - IXMLDOMDocument *m_pIXMLDOMDocument; - VARIANT m_NextVar; - }; - - typedef iterator const_iterator; - - NodeContainerImpl() - :m_NextNodeIndex(0) - ,m_pIXMLDOMDocument(NULL) - {} - - iterator begin() - { - return iterator(m_container,0,m_pIXMLDOMDocument); - } - - iterator end() - { - if (m_container == 0) - return iterator(m_container,0,m_pIXMLDOMDocument); - else - return iterator(m_container,m_container->getLength(),m_pIXMLDOMDocument); - } - - void SetOwnerDoc(IXMLDOMDocument *p) - { - m_pIXMLDOMDocument = p; - if (m_pIXMLDOMDocument != NULL) - m_pIXMLDOMDocument->AddRef(); - } - - T* m_container; - -protected: - - int m_NextNodeIndex; - IXMLDOMDocument *m_pIXMLDOMDocument; - - void ReleaseOwnerDoc() - { - if (m_pIXMLDOMDocument != NULL) { - m_pIXMLDOMDocument->Release(); - m_pIXMLDOMDocument = NULL; - } - } -}; - -#endif // ___nodecontainerimpl_h___ diff --git a/src/xercesc/com/README.txt b/src/xercesc/com/README.txt deleted file mode 100644 index 6da31fe89..000000000 --- a/src/xercesc/com/README.txt +++ /dev/null @@ -1,44 +0,0 @@ - -COM Wrapper ------------ - -xerces-com.dll needs to be registered before its first use. This can be done using either through the References Dialog in Microsoft(r) Visual Basic (tm) or Microsoft(r) Excel or using REGSVR32.EXE, -provided with many Windows development environments. - -To register using Microsoft(r) Visual Basic 6.0, select Project/References from the menu to show the References dialog, press the Browse dialog and then select xerces-com.dll. In Microsoft(r) Excel, -select Tools/Macro/Visual Basic Editor to show the VBA editor and then select Tools/References for the references dialog. - -To register using REGSVR32 from the command line, type REGSVR32 followed by the path name of xerces-com.dll. - -After registration, the xerces-com will appear on the References dialog as "Xerces XML Parser". - -xerces-com was designed to support the same interfaces as Microsoft XML 2.0. For many Visual Basic applications, the only changes necessary are to add the reference to Xerces XML Parser, remove the -reference to Microsoft XML 2.0, and to change the line that creates the parser object. - -Each of the following lines would create an instance of a Microsoft XML 2.0 parser: - -Dim xmlparser as new MSXML.DOMDocument -Dim xmlparser as new DOMDocument -Set object = CreateObject("MSXML.DOMDocument") -Set object = CreateObject("MSXML2.DOMDocument") - -The following lines would create an instance of a Xerces parser: - -Dim xmlparser as new Xerces.DOMDocument -Dim xmlparser as new DOMDocument -Set object = CreateObject("Xerces.DOMDocument") -set object = CreateObject("Xerces.DOMDocument.2.3.0") - -If you leave both MSXML and Xerces in the same project, you may need to disambiguate interfaces by prepending MSXML or Xerces. - -For many applications, MSXML and Xerces will be interchangable. However, there may be documents that MSXML rejects and Xerces accepts and vice versa and the DOM presented to the application may be -slightly different. Specific examples include: - -MSXML represents entity references as entity reference elements, -Xerces expands the entity references. - -MSXML represents the XML declaration as a processing instruction node, -Xerces does not represent the XML declaration. - -MSXML will suppress whitespace nodes regardless of validation setting when preserveWhitespace = false, -Xerces will only suppress whitespace when validation = true. diff --git a/src/xercesc/com/StdAfx.cpp b/src/xercesc/com/StdAfx.cpp deleted file mode 100644 index 39fe86f3e..000000000 --- a/src/xercesc/com/StdAfx.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// stdafx.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -#if defined(_ATL_STATIC_REGISTRY) -#include <statreg.h> -#if defined(_MSC_VER) && _MSC_VER < 1300 -#include <statreg.cpp> -#endif -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1300 -#include <atlimpl.cpp> -#endif - -// -// This macro is defined in MSXML.H's compatible with IE5 -// and not defined in those from IE4. -// -// To correct, install a IE5 or later version of the Microsoft Platform SDK -// and add \Program Files\Microsoft Platform SDK\Include as the first entry -// on the Directories tab on the dialog displayed after selecting Tools Options -// from the Visual Studio IDE. -// -#ifndef __IXMLDOMNode_INTERFACE_DEFINED__ -#error "xerces-dom requires an MSXML.H compatible with IE5 or later. See http://xerces.apache.org/xerces-c/build.html#BuildCOM for directions to correct this problem." -#endif - diff --git a/src/xercesc/com/StdAfx.h b/src/xercesc/com/StdAfx.h deleted file mode 100644 index 895ef920d..000000000 --- a/src/xercesc/com/StdAfx.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#if !defined(AFX_STDAFX_H__975CB5CC_234E_4CA0_940E_DA102634BF51__INCLUDED_) -#define AFX_STDAFX_H__975CB5CC_234E_4CA0_940E_DA102634BF51__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - -#define STRICT -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0400 -#endif -#define _ATL_APARTMENT_THREADED - -#define DOMDocument _MSXMLDOMDocument -#define XMLHTTPRequest _MSXMLHTTPRequest -#define CLSID_DOMDocument CLSID_MSDOMDocument -#define CLSID_XMLHTTPRequest CLSID_MSXMLHTTPRequest - -// -// suppress MSXML.H since we duplicate some of the information -// in xml4com.h -// - -#include <atlbase.h> -//You may derive a class from CComModule and use it if you want to override -//something, but do not change the name of _Module -extern CComModule _Module; -#include <atlcom.h> -#include <atlctl.h> -#include <comdef.h> -#include <ExDisp.h> -#include <ShlGuid.h> -#include <stdio.h> -#include <process.h> -#include <Wininet.h> - -#undef DOMDocument -#undef XMLHTTPRequest -#undef CLSID_DOMDocument -#undef CLSID_XMLHTTPRequest - -// -// These are defined in xml4dom_i.c which is included in xml4dom.cpp -// -// -extern const IID CLSID_DOMDocument; -extern const IID CLSID_XMLHTTPRequest; -extern const IID LIBID_Xerces; - -const long MSG_READY_STATE_CHANGE = WM_APP + 0x0001; - - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__975CB5CC_234E_4CA0_940E_DA102634BF51__INCLUDED) diff --git a/src/xercesc/com/XMLDOMAttribute.cpp b/src/xercesc/com/XMLDOMAttribute.cpp deleted file mode 100644 index b81153ac6..000000000 --- a/src/xercesc/com/XMLDOMAttribute.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMAttribute.h" - -// IXMLDOMAttribute methods -STDMETHODIMP CXMLDOMAttribute::get_name(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMAttribute::get_name\n")); - - if (NULL == pVal) - return E_POINTER; - - try - { - *pVal = SysAllocString(attr->getName()); - } - catch(DOMException& ex) { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHODIMP CXMLDOMAttribute::get_value(VARIANT *pVal) -{ - ATLTRACE(_T("CXMLDOMAttribute::get_value\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - - try - { - V_VT(pVal) = VT_BSTR; - V_BSTR(pVal) = SysAllocString(attr->getValue()); - } - catch(DOMException& ex) { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHODIMP CXMLDOMAttribute::put_value(VARIANT newVal) -{ - ATLTRACE(_T("CXMLDOMAttribute::put_value\n")); - - try - { - if(V_VT(&newVal) == VT_BSTR) { - attr->setValue(V_BSTR(&newVal)); - } - else { - attr->setValue((BSTR) (_bstr_t) newVal); - } - - attr->setValue(V_BSTR(&newVal)); - } - catch(DOMException& ex) { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - - // IXMLDOMNode method -STDMETHODIMP CXMLDOMAttribute::get_specified(VARIANT_BOOL *pVal) -{ - ATLTRACE(_T("CXMLDOMAttribute::get_specified\n")); - - try - { - *pVal = attr->getSpecified() ? VARIANT_TRUE : VARIANT_FALSE; - } - catch(DOMException& ex) { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - - -STDMETHODIMP CXMLDOMAttribute::get_nodeValue(VARIANT *pVal) -{ - ATLTRACE(_T("CXMLDOMAttribute::get_nodeValue\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - - try - { - V_VT(pVal) = VT_BSTR; - V_BSTR(pVal) = SysAllocString(attr->getValue()); - } - catch(DOMException& ex) { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - - diff --git a/src/xercesc/com/XMLDOMAttribute.h b/src/xercesc/com/XMLDOMAttribute.h deleted file mode 100644 index 4bad946c5..000000000 --- a/src/xercesc/com/XMLDOMAttribute.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomattribute_h___ -#define ___xmldomattribute_h___ - -#include <xercesc/dom/DOMAttr.hpp> -#include "IXMLDOMNodeImpl.h" -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMAttribute : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMAttribute, &IID_IXMLDOMAttribute> -{ -public: - CXMLDOMAttribute() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return attr;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_ATTRIBUTE; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMAttribute) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMAttribute) - COM_INTERFACE_ENTRY(IXMLDOMAttribute) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - - // IXMLDOMNode method - STDMETHOD(get_specified)(VARIANT_BOOL *pVal); - - - // IXMLDOMAttribute methods - STDMETHOD(get_name)(BSTR *pVal); - STDMETHOD(get_value)(VARIANT *pVal); - STDMETHOD(put_value)(VARIANT newVal); - - // - // override IXMLDOMNodeImpl to always return a string - // even when empty - // - STDMETHOD(get_nodeValue)(VARIANT* pVal); - - DOMAttr* attr; -}; - -typedef CComObject<CXMLDOMAttribute> CXMLDOMAttributeObj; - -#endif // ___xmldomattribute_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMCDATASection.h b/src/xercesc/com/XMLDOMCDATASection.h deleted file mode 100644 index 4f63312c9..000000000 --- a/src/xercesc/com/XMLDOMCDATASection.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomcdatasection_h___ -#define ___xmldomcdatasection_h___ - -#include <xercesc/dom/DOMCDATASection.hpp> -#include "IXMLDOMTextImpl.h" -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMCDATASection : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMTextImpl<IXMLDOMCDATASection, &IID_IXMLDOMCDATASection> -{ -public: - CXMLDOMCDATASection() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMText* get_DOMText() { return cdataSection;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_CDATA_SECTION; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMCDATASection) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMCDATASection) - COM_INTERFACE_ENTRY(IXMLDOMCDATASection) - COM_INTERFACE_ENTRY(IXMLDOMText) - COM_INTERFACE_ENTRY(IXMLDOMCharacterData) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - - DOMCDATASection* cdataSection; -}; - -typedef CComObject<CXMLDOMCDATASection> CXMLDOMCDATASectionObj; - -#endif // ___xmldomcdatasection_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMComment.h b/src/xercesc/com/XMLDOMComment.h deleted file mode 100644 index 1f4deb3ee..000000000 --- a/src/xercesc/com/XMLDOMComment.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomcomment_h___ -#define ___xmldomcomment_h___ - -#include <xercesc/dom/DOMComment.hpp> -#include "IXMLDOMCharacterDataImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMComment : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMCharacterDataImpl<IXMLDOMComment, &IID_IXMLDOMComment> -{ -public: - CXMLDOMComment() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMCharacterData* get_DOMCharacterData() { return comment;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_COMMENT; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMComment) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMComment) - COM_INTERFACE_ENTRY(IXMLDOMComment) - COM_INTERFACE_ENTRY(IXMLDOMCharacterData) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - - DOMComment* comment; -}; - -typedef CComObject<CXMLDOMComment> CXMLDOMCommentObj; - -#endif // ___xmldomcomment_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMDocument.cpp b/src/xercesc/com/XMLDOMDocument.cpp deleted file mode 100644 index 14a549f82..000000000 --- a/src/xercesc/com/XMLDOMDocument.cpp +++ /dev/null @@ -1,1598 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" - -#include <xercesc/parsers/XercesDOMParser.hpp> -#include <xercesc/sax/SAXParseException.hpp> -#include <xercesc/framework/MemBufInputSource.hpp> -#include <xercesc/dom/DOMImplementation.hpp> - -#include "xml4com.h" -#include "XMLDOMDocument.h" -#include "XMLDOMUtil.h" -#include "XMLDOMNodeList.h" -#include "XMLDOMNamedNodeMap.h" -#include "XMLDOMDocumentType.h" -#include "XMLDOMImplementation.h" -#include "XMLDOMElement.h" -#include "XMLDOMDocumentFragment.h" -#include "XMLDOMText.h" -#include "XMLDOMComment.h" -#include "XMLDOMCDATASection.h" -#include "XMLDOMProcessingInstruction.h" -#include "XMLDOMAttribute.h" -#include "XMLDOMEntityReference.h" -#include "BindStatusCallback.h" - -// I need to make sure the file is registered with long filenames -HRESULT WINAPI CXMLDOMDocument::UpdateRegistry(BOOL bRegister) -{ - USES_CONVERSION; - - TCHAR file[MAX_PATH]; - if (::GetModuleFileName(_Module.m_hInst, file, MAX_PATH)) { - WIN32_FIND_DATA d; - memset(&d,0,sizeof(WIN32_FIND_DATA)); - HANDLE h = FindFirstFile(file,&d); - if (h != INVALID_HANDLE_VALUE) { - TCHAR *name = _tcsrchr(file,_T('\\')); - TCHAR newFile[MAX_PATH] = _T(""); - _tcsncpy(newFile,file,name-file); - _tcscat(newFile,_T("\\")); - _tcscat(newFile,d.cFileName); - FindClose(h); - - _ATL_REGMAP_ENTRY regmap[2] = {{NULL,NULL},{NULL,NULL}}; - regmap[0].szKey = OLESTR("XMLMODULE"); - regmap[0].szData = T2OLE(newFile); - return _Module.UpdateRegistryFromResource((UINT) IDR_XMLDOCUMENT, bRegister,regmap); - } - } - return E_FAIL; -} - -CXMLDOMDocument::CXMLDOMDocument() - :m_Document (NULL) - ,m_bValidate (false) - ,m_lReadyState (0) - ,m_url (_T("")) - ,m_pParseError (NULL) - ,m_bAsync (false) - ,m_bAbort (false) - ,m_hParseThread (NULL) - ,m_pOnReadyStateChange (NULL) - ,m_pOnDataAvailable (NULL) - ,m_pOnTransformNode (NULL) - ,m_FileName (_T("")) - ,m_xml (_T("")) - ,m_bParseError (false) - ,m_bThreadValidate (false) - ,m_bPreserveWhiteSpace (false) - ,m_TmpDocument (NULL) -{ -} - -HRESULT CXMLDOMDocument::FinalConstruct() -{ - // create monitor window - RECT rc; - memset(&rc,0,sizeof(RECT)); - if (NULL == Create(NULL, rc, _T("XML Parse Monitor Window"), 0)) - return E_FAIL; - - HRESULT hr = CXMLDOMParseErrorObj::CreateInstance(&m_pParseError); - if (S_OK != hr) - return hr; - - m_pParseError->AddRef(); - m_pIXMLDOMDocument = this; - - m_Document = DOMImplementation::getImplementation()->createDocument(); - - return hr; -} - -void CXMLDOMDocument::FinalRelease() -{ - if (NULL != m_hParseThread) { - m_bAbort = true; - ::WaitForSingleObject(m_hParseThread, INFINITE); - ::CloseHandle(m_hParseThread); - m_hParseThread = NULL; - } - - if (m_pParseError != NULL) { - m_pParseError->Release(); - m_pParseError = NULL; - } - if (m_pOnReadyStateChange != NULL) { - m_pOnReadyStateChange->Release(); - m_pOnReadyStateChange = NULL; - } - if (m_pOnDataAvailable != NULL) { - m_pOnDataAvailable->Release(); - m_pOnDataAvailable = NULL; - } - if (m_pOnTransformNode != NULL) { - m_pOnTransformNode->Release(); - m_pOnTransformNode = NULL; - } - - if(m_Document) - delete m_Document; - m_Document = NULL; - - DestroyWindow(); -} - -void CXMLDOMDocument::warning(const SAXParseException& exc) -{ - // ignore warnings -} - -void CXMLDOMDocument::error(const SAXParseException& exc) -{ - m_pParseError->SetData(1, - exc.getSystemId(), - exc.getMessage(), - _T(""), - exc.getLineNumber(), - exc.getColumnNumber(), - 0); - m_bParseError = true; -} - -void CXMLDOMDocument::fatalError(const SAXParseException& exc) -{ - m_pParseError->SetData(1, - exc.getSystemId(), - exc.getMessage(), - _T(""), - exc.getLineNumber(), - exc.getColumnNumber(), - 0); - m_bParseError = true; -} - -LRESULT CXMLDOMDocument::OnReadyStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - ATLTRACE(_T("CXMLDOMDocument::OnReadyStateChange\n")); - - bHandled = TRUE; - - m_lReadyState = (long)wParam; - Fire_onreadystatechange(); - if (NULL != m_pOnReadyStateChange) { - CComVariant varResult; - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - m_pOnReadyStateChange->Invoke(DISPID_VALUE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL); - } - if (m_lReadyState != 4) - return 1L; - - if(m_Document) - delete m_Document; - m_Document = m_TmpDocument; - m_TmpDocument = 0; - - m_url = m_FileName; - - if (!m_bParseError) { - Fire_ondataavailable(); - if (NULL != m_pOnDataAvailable) { - CComVariant varResult; - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - m_pOnDataAvailable->Invoke(DISPID_VALUE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL); - } - } - - return 1L; -} - -STDMETHODIMP CXMLDOMDocument::InterfaceSupportsErrorInfo(REFIID riid) -{ - if (IsEqualGUID(IID_IXMLDOMDocument,riid)) - return S_OK; - return S_FALSE; -} - -STDMETHODIMP CXMLDOMDocument::get_doctype(IXMLDOMDocumentType **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_doctype\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - DOMDocumentType* doctype = m_Document->getDoctype(); - - // - // if the document had no doctype then return a null object - // - if(doctype==NULL) - return S_OK; - - CXMLDOMDocumentTypeObj *pObj = NULL; - HRESULT hr = CXMLDOMDocumentTypeObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->documentType = doctype; - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMDocumentType, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::get_implementation(IXMLDOMImplementation **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_implementation\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMImplementationObj *pObj = NULL; - HRESULT hr = CXMLDOMImplementationObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - - hr = pObj->QueryInterface(IID_IXMLDOMImplementation, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::get_documentElement(IXMLDOMElement * *pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_documentElement\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMElementObj *pObj = NULL; - HRESULT hr = CXMLDOMElementObj::CreateInstance(&pObj); - if (S_OK != hr) - return S_OK; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->element = m_Document->getDocumentElement(); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return S_OK; - } - - hr = pObj->QueryInterface(IID_IXMLDOMElement, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::putref_documentElement(IXMLDOMElement *newVal) -{ - ATLTRACE(_T("CXMLDOMDocument::putref_documentElement\n")); - - DOMElement* elem; - - try - { - elem = m_Document->getDocumentElement(); - if (NULL == newVal && elem!=NULL) { - m_Document->removeChild(elem); - return S_OK; - } - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - CComQIPtr<IIBMXMLDOMNodeIdentity,&IID_IIBMXMLDOMNodeIdentity> pNewVal(newVal); - if (!pNewVal) - return E_NOINTERFACE; - - long id = 0; - HRESULT hr = pNewVal->get_NodeId(&id); - if (S_OK != hr) - return hr; - - DOMNode *pNewValNode = reinterpret_cast<DOMNode*> (id); - if (NULL == pNewValNode) - return E_INVALIDARG; - - try - { - if(elem==NULL) - m_Document->appendChild(pNewValNode); - else - m_Document->replaceChild(pNewValNode, elem); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::createElement(BSTR tagName, IXMLDOMElement **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::createElement\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMElementObj *pObj = NULL; - HRESULT hr = CXMLDOMElementObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->element = m_Document->createElement(tagName); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMElement, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::createDocumentFragment(IXMLDOMDocumentFragment **docFrag) -{ - ATLTRACE(_T("CXMLDOMDocument::createDocumentFragment\n")); - - if (NULL == docFrag) - return E_POINTER; - - *docFrag = NULL; - - CXMLDOMDocumentFragmentObj *pObj = NULL; - HRESULT hr = CXMLDOMDocumentFragmentObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->documentFragment = m_Document->createDocumentFragment(); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMDocumentFragment, reinterpret_cast<LPVOID*> (docFrag)); - if (S_OK != hr) - *docFrag = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::createTextNode(BSTR data, IXMLDOMText **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::createTextNode\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMTextObj *pObj = NULL; - HRESULT hr = CXMLDOMTextObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->text = m_Document->createTextNode(data); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMText, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::createComment(BSTR data, IXMLDOMComment **comment) -{ - ATLTRACE(_T("CXMLDOMDocument::createComment\n")); - - if (NULL == comment) - return E_POINTER; - - *comment = NULL; - - CXMLDOMCommentObj *pObj = NULL; - HRESULT hr = CXMLDOMCommentObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->comment = m_Document->createComment(data); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMComment, reinterpret_cast<LPVOID*> (comment)); - if (S_OK != hr) - *comment = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::createCDATASection(BSTR data, IXMLDOMCDATASection **cdata) -{ - ATLTRACE(_T("CXMLDOMDocument::createCDATASection\n")); - - if (NULL == cdata) - return E_POINTER; - - *cdata = NULL; - - CXMLDOMCDATASectionObj *pObj = NULL; - HRESULT hr = CXMLDOMCDATASectionObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->cdataSection = m_Document->createCDATASection(data); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMCDATASection, reinterpret_cast<LPVOID*> (cdata)); - if (S_OK != hr) - *cdata = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::createProcessingInstruction(BSTR target, BSTR data, IXMLDOMProcessingInstruction **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::createProcessingInstruction\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMProcessingInstructionObj *pObj = NULL; - HRESULT hr = CXMLDOMProcessingInstructionObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->processingInstruction = m_Document->createProcessingInstruction(target, data); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMProcessingInstruction, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::createAttribute(BSTR name, IXMLDOMAttribute **attr) -{ - ATLTRACE(_T("CXMLDOMDocument::createAttribute\n")); - - if (NULL == attr) - return E_POINTER; - - *attr = NULL; - - CXMLDOMAttributeObj *pObj = NULL; - HRESULT hr = CXMLDOMAttributeObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->attr = m_Document->createAttribute(name); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMAttribute, reinterpret_cast<LPVOID*> (attr)); - if (S_OK != hr) - *attr = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::createEntityReference(BSTR name, IXMLDOMEntityReference **entityRef) -{ - ATLTRACE(_T("CXMLDOMDocument::createEntityReference\n")); - - if (NULL == entityRef) - return E_POINTER; - - *entityRef = NULL; - - CXMLDOMEntityReferenceObj *pObj = NULL; - HRESULT hr = CXMLDOMEntityReferenceObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(this); - - try - { - pObj->entityReference = m_Document->createEntityReference(name); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMEntityReference, reinterpret_cast<LPVOID*> (entityRef)); - if (S_OK != hr) - *entityRef = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::getElementsByTagName(BSTR tagName, IXMLDOMNodeList **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::getElementsByTagName\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMNodeListObj *pObj = NULL; - HRESULT hr = CXMLDOMNodeListObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - - try - { - pObj->m_container = m_Document->getElementsByTagName(tagName); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMNodeList, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocument::createNode(VARIANT TYPE, BSTR name, BSTR namespaceURI, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::createNode\n")); - - HRESULT hr = S_OK; - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - VARIANT type; - ::VariantInit(&type); - if (V_VT(&TYPE) != VT_I4 && V_VT(&TYPE) != VT_BSTR) - hr = ::VariantChangeType(&type,&TYPE,0,VT_I4); - else - hr = ::VariantCopy(&type,&TYPE); - - if (S_OK != hr) - return hr; - - DOMNodeType nodeType = NODE_INVALID; - if (VT_I4 == V_VT(&type)) - nodeType = static_cast<DOMNodeType> (V_I4(&type)); - else { - OLECHAR* str = V_BSTR(&type); - for (int i = 0; i < g_DomNodeNameSize; ++i) { - if (0 == _wcsicmp(str,g_DomNodeName[i])) { - nodeType = static_cast<DOMNodeType> (i); - break; - } - } - } - - ::VariantClear(&type); - - if (NODE_INVALID == nodeType || - NODE_DOCUMENT == nodeType || - NODE_DOCUMENT_TYPE == nodeType || - NODE_ENTITY == nodeType || - NODE_NOTATION == nodeType) - return E_FAIL; - - try - { - switch(nodeType) { - case NODE_ELEMENT: - { - DOMElement* node; - if (SysStringLen(namespaceURI) > 0) - node = m_Document->createElementNS(namespaceURI,name); - else - node = m_Document->createElement(name); - - hr = wrapNode(m_pIXMLDOMDocument,node,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - break; - } - case NODE_ATTRIBUTE: - { - DOMAttr* node; - if (SysStringLen(namespaceURI) > 0) - node = m_Document->createAttributeNS(namespaceURI,name); - else - node = m_Document->createAttribute(name); - - hr = wrapNode(m_pIXMLDOMDocument,node,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - break; - } - case NODE_TEXT: - { - DOMText* node = m_Document->createTextNode(OLESTR("")); - hr = wrapNode(m_pIXMLDOMDocument,node,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - break; - } - case NODE_CDATA_SECTION: - { - DOMCDATASection* node = m_Document->createCDATASection(OLESTR("")); - hr = wrapNode(m_pIXMLDOMDocument,node,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - break; - } - case NODE_ENTITY_REFERENCE: - { - DOMEntityReference* node = m_Document->createEntityReference(name); - hr = wrapNode(m_pIXMLDOMDocument,node,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - break; - } - case NODE_PROCESSING_INSTRUCTION: - { - DOMProcessingInstruction* node = m_Document->createProcessingInstruction(name,OLESTR("")); - hr = wrapNode(m_pIXMLDOMDocument,node,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - break; - } - case NODE_COMMENT: - { - DOMComment* node = m_Document->createComment(OLESTR("")); - hr = wrapNode(m_pIXMLDOMDocument,node,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - break; - } - case NODE_DOCUMENT_FRAGMENT: - { - DOMDocumentFragment* node = m_Document->createDocumentFragment(); - hr = wrapNode(m_pIXMLDOMDocument,node,IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - break; - } - default: - hr = E_FAIL; - break; - } - } - catch(DOMException& ex) - { - hr = MakeHRESULT(ex); - } - catch (...) - { - hr = E_FAIL; - } - - return hr; -} - -STDMETHODIMP CXMLDOMDocument::nodeFromID(BSTR idString, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::nodeFromID\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - HRESULT hr = S_OK; - - try - { - hr = wrapNode(m_pIXMLDOMDocument, m_Document->getElementById(idString),IID_IXMLDOMNode,reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return hr; -} - -STDMETHODIMP CXMLDOMDocument::load(VARIANT xmlSource, VARIANT_BOOL *isSuccessful) -{ - ATLTRACE(_T("CXMLDOMDocument::load\n")); - - if (NULL == isSuccessful) - return E_POINTER; - - *isSuccessful = VARIANT_FALSE; - - if (V_VT(&xmlSource) != VT_BSTR && - V_VT(&xmlSource) != VT_DISPATCH && - V_VT(&xmlSource) != (VT_ARRAY | VT_VARIANT) && - V_VT(&xmlSource) != (VT_ARRAY | VT_UI1) && - V_VT(&xmlSource) != VT_UNKNOWN) - return E_INVALIDARG; - - // do not start another thread if there is another active - if (NULL != m_hParseThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hParseThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return S_OK; - - ::CloseHandle(m_hParseThread); - m_hParseThread = NULL; - } - - HRESULT hr = S_OK; - m_bAbort = false; - - m_FileName = _T(""); - m_xml = _T(""); - m_TmpDocument = 0; - m_bThreadValidate = m_bValidate; - - if (V_VT(&xmlSource) == VT_BSTR) { - m_FileName = V_BSTR(&xmlSource); - if (0 == m_FileName.length()) - return E_INVALIDARG; - - // see if the file is relative path - if (!PathIsURL(m_FileName) && PathIsRelative(m_FileName)) { - // try appending baseurl if exists - _bstr_t baseURL; - if (S_OK == GetBaseURL(baseURL)) { - TCHAR szCurFile[MAX_PATH]; - _tcscpy(szCurFile, m_FileName); - // change any backslashes to slashes - LPTSTR loc = _tcschr(szCurFile,_T('\\')); - while (loc != NULL) { - *loc = _T('/'); - loc = _tcschr(szCurFile,_T('\\')); - } - m_FileName = baseURL + _T("/") + szCurFile; - } - else { - TCHAR szCurDir[MAX_PATH]; - GetCurrentDirectory(MAX_PATH,szCurDir); - m_FileName=_bstr_t(szCurDir) + _T("\\") + m_FileName; - } - } - } - else - if (V_VT(&xmlSource) == VT_UNKNOWN) { - CComQIPtr<IStream,&IID_IStream> pS(V_UNKNOWN(&xmlSource)); - if (!pS) - return E_INVALIDARG; - - CComBSTR b; - hr = b.ReadFromStream(pS); - if (S_OK != hr) - return hr; - - m_xml = b; - if (0 == m_xml.length()) - return E_INVALIDARG; - } - else - if (V_VT(&xmlSource) == VT_DISPATCH) { - CComQIPtr<IXMLDOMDocument,&IID_IXMLDOMDocument> pDoc(V_DISPATCH(&xmlSource)); - if (!pDoc) - return E_INVALIDARG; - - BSTR b = NULL; - hr = pDoc->get_xml(&b); - if (S_OK != hr) - return hr; - - m_xml = b; - ::SysFreeString(b); - - if (0 == m_xml.length()) - return E_INVALIDARG; - } - else - if (V_VT(&xmlSource) == (VT_ARRAY | VT_VARIANT)) { - SAFEARRAY *pArray = reinterpret_cast<SAFEARRAY *> (xmlSource.byref); - if (NULL == pArray) - return E_INVALIDARG; - - long lLBoundVar = 0; - long lUBoundVar = 0; - - UINT dims = ::SafeArrayGetDim(pArray); - if (dims == 0) - return E_INVALIDARG; - - hr = ::SafeArrayGetLBound(pArray, dims, &lLBoundVar); - if (S_OK != hr) - return hr; - - hr = ::SafeArrayGetUBound(pArray, dims, &lUBoundVar); - if (S_OK != hr) - return hr; - - if (lUBoundVar >= lLBoundVar) { - VARIANT *pIndex = NULL; - hr = ::SafeArrayAccessData(pArray, reinterpret_cast<void **> (&pIndex)); - if (S_OK != hr) - return hr; - - int length = lUBoundVar-lLBoundVar+2; - BYTE *body = new BYTE[length]; - for (long i = 0; i <= lUBoundVar-lLBoundVar; ++i) { - VARIANT var = pIndex[i]; - if (V_VT(&var) != VT_UI1) { - hr = E_INVALIDARG; - break; - } - body[i] = V_UI1(&var); - } - body[length-1] = 0; - - ::SafeArrayUnaccessData(pArray); - if (S_OK != hr) { - delete [] body; - return hr; - } - m_xml = reinterpret_cast<char*> (body); - delete [] body; - if (0 == m_xml.length()) - return E_INVALIDARG; - } - } - else - if (V_VT(&xmlSource) == (VT_ARRAY | VT_UI1)) { - SAFEARRAY *pArray = reinterpret_cast<SAFEARRAY *> (xmlSource.byref); - if (NULL == pArray) - return E_INVALIDARG; - - long lLBoundVar = 0; - long lUBoundVar = 0; - - UINT dims = ::SafeArrayGetDim(pArray); - if (dims == 0) - return E_INVALIDARG; - - hr = ::SafeArrayGetLBound(pArray, dims, &lLBoundVar); - if (S_OK != hr) - return hr; - - hr = ::SafeArrayGetUBound(pArray, dims, &lUBoundVar); - if (S_OK != hr) - return hr; - - if (lUBoundVar >= lLBoundVar) { - BYTE *pIndex = NULL; - hr = ::SafeArrayAccessData(pArray, reinterpret_cast<void **> (&pIndex)); - if (S_OK != hr) - return hr; - - int length = lUBoundVar-lLBoundVar+2; - BYTE *body = new BYTE[length]; - for (long i = 0; i <= lUBoundVar-lLBoundVar; ++i) - body[i] = pIndex[i]; - - body[length-1] = 0; - ::SafeArrayUnaccessData(pArray); - m_xml = reinterpret_cast<char*> (body); - delete [] body; - if (0 == m_xml.length()) - return E_INVALIDARG; - } - } - - UINT nthreadID = 0; - m_hParseThread = reinterpret_cast<HANDLE> (_beginthreadex(NULL, - 0, - CXMLDOMDocument::ParseThread, - (void *) this, - 0, - &nthreadID)); - if (NULL == m_hParseThread) - return S_OK; - - if (m_bAsync) { - *isSuccessful = VARIANT_TRUE; - return S_OK; - } - - bool bWait = true; - while (bWait) { - DWORD dwEvt = MsgWaitForMultipleObjects(1,&m_hParseThread,FALSE,INFINITE,QS_ALLINPUT); - switch(dwEvt) { - case WAIT_OBJECT_0: - bWait = false; - break; - case WAIT_OBJECT_0 + 1: - { - MSG msg; - while(::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { - if (WM_CLOSE == msg.message || WM_QUIT == msg.message) { - bWait = false; - m_bAbort = true; - break; - } - else { - PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - break; - } - default: - m_bAbort = true; - bWait = false; - break; - } - } - - if (m_bAbort) - return S_OK; - - if (m_bParseError) - return hr; - - if(m_Document) - delete m_Document; - m_Document = m_TmpDocument; - m_TmpDocument = 0; - - m_url = m_FileName; - *isSuccessful = VARIANT_TRUE; - - return hr; -} - -HRESULT CXMLDOMDocument::GetBaseURL(_bstr_t &baseURL) -{ - baseURL = _T(""); - CComPtr<IServiceProvider> pSP; - HRESULT hr = GetSite(IID_IServiceProvider, reinterpret_cast<LPVOID *> (&pSP)); - if (S_OK != hr) - return hr; - - CComPtr<IWebBrowser2> pWB; - hr = pSP->QueryService(SID_SWebBrowserApp,IID_IWebBrowser2, - reinterpret_cast<LPVOID *> (&pWB)); - if (S_OK != hr) - return hr; - - BSTR b = NULL; - hr = pWB->get_LocationURL(&b); - if (S_OK != hr) - return hr; - - TCHAR url[MAX_PATH] = _T(""); - lstrcat(url,_bstr_t(b)); - - // look for last slash and remove the filename after it - LPTSTR loc = _tcsrchr(url, _T('/')); - if (loc != NULL) { - TCHAR str[MAX_PATH] = _T(""); - _tcsncpy(str, url, loc - url); - lstrcpy(url,str); - } - - baseURL = url; - return hr; -} - -STDMETHODIMP CXMLDOMDocument::get_readyState(long *pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_readyState\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = m_lReadyState; - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::get_parseError(IXMLDOMParseError **pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_parseError\n")); - - if (NULL == pVal) - return E_POINTER; - - return m_pParseError->QueryInterface(IID_IXMLDOMParseError, reinterpret_cast<LPVOID*> (pVal)); -} - -STDMETHODIMP CXMLDOMDocument::get_url(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_url\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = m_url.copy(); - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::get_async(VARIANT_BOOL *pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_async\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = m_bAsync ? VARIANT_TRUE : VARIANT_FALSE; - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::put_async(VARIANT_BOOL newVal) -{ - ATLTRACE(_T("CXMLDOMDocument::put_async\n")); - - m_bAsync = (VARIANT_TRUE == newVal) ? true : false; - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::abort(void) -{ - ATLTRACE(_T("CXMLDOMDocument::abort\n")); - m_bAbort = true; - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::loadXML(BSTR bstrXML, VARIANT_BOOL *isSuccessful) -{ - ATLTRACE(_T("CXMLDOMDocument::loadXML\n")); - - if (NULL == isSuccessful) - return E_POINTER; - - *isSuccessful = VARIANT_FALSE; - - // do not start another thread if there is another active - if (NULL != m_hParseThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hParseThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return S_OK; - - ::CloseHandle(m_hParseThread); - m_hParseThread = NULL; - } - - HRESULT hr = S_OK; - m_bAbort = false; - - m_FileName = _T(""); - m_TmpDocument = 0; - m_bThreadValidate = m_bValidate; - - m_xml = bstrXML; - if (0 == m_xml.length()) - return E_INVALIDARG; - - UINT nthreadID = 0; - m_hParseThread = reinterpret_cast<HANDLE> (_beginthreadex(NULL, - 0, - CXMLDOMDocument::ParseThread, - (void *) this, - 0, - &nthreadID)); - if (NULL == m_hParseThread) - return S_OK; - - if (m_bAsync) { - *isSuccessful = VARIANT_TRUE; - return S_OK; - } - - bool bWait = true; - while (bWait) { - DWORD dwEvt = MsgWaitForMultipleObjects(1,&m_hParseThread,FALSE,INFINITE,QS_ALLINPUT); - switch(dwEvt) { - case WAIT_OBJECT_0: - bWait = false; - break; - case WAIT_OBJECT_0 + 1: - { - MSG msg; - while(::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { - if (WM_CLOSE == msg.message || WM_QUIT == msg.message) { - bWait = false; - m_bAbort = true; - break; - } - else { - PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - break; - } - default: - m_bAbort = true; - bWait = false; - break; - } - } - - if (m_bAbort) - return S_OK; - - if (m_bParseError) - return hr; - - if(m_Document) - delete m_Document; - m_Document = m_TmpDocument; - m_TmpDocument = 0; - - m_url = m_FileName; - *isSuccessful = VARIANT_TRUE; - - return hr; -} - -UINT APIENTRY CXMLDOMDocument::ParseThread(void *pParm) -{ - ATLTRACE(_T("CXMLDOMDocument::ParseThread\n")); - - CXMLDOMDocument *pThis = reinterpret_cast<CXMLDOMDocument *> (pParm); - if (NULL == pThis) - return 0; - - if (!pThis->m_bAbort && pThis->m_FileName.length() > 0) { - CBindStatCallbackObj *pCallbackObj = NULL; - HRESULT hr = CBindStatCallbackObj::CreateInstance(&pCallbackObj); - if (S_OK != hr) - pCallbackObj = NULL; - - if (pCallbackObj != NULL) { - pCallbackObj->AddRef(); - pCallbackObj->m_pDoc = pThis; - } - TCHAR name[MAX_PATH] = _T(""); - if (pThis->m_bAsync) - pThis->PostMessage(MSG_READY_STATE_CHANGE,1); - - hr = URLDownloadToCacheFile(NULL,pThis->m_FileName,name,URLOSTRM_GETNEWESTVERSION,0,pCallbackObj); - if (pCallbackObj != NULL) - pCallbackObj->Release(); - - if (E_ABORT == hr) - pThis->m_bAbort = true; - else { - if (S_OK != hr) { - _bstr_t error = _T("Failed to download ") + pThis->m_FileName + _T(": "); - _com_error comError(hr); - error += comError.ErrorMessage(); - pThis->m_pParseError->SetData(1,pThis->m_FileName,error,_T(""),0,0,0); - pThis->m_bParseError = true; - } - } - - if (S_OK == hr) { - pThis->m_FileName = name; - if (pThis->m_bAsync) - pThis->PostMessage(MSG_READY_STATE_CHANGE,2); - } - } - - XercesDOMParser parser; - - // - // If set to true then an node supporting IXMLDOMProcessingInstruction - // is added for the XML declaration. - // - // Setting to true in a custom DLL will better mimic - // MSXML.DLL but at a cost of conformance errors - // using David Brownell's suite - //parser.setToCreateXMLDeclTypeNode(false); - - parser.setIncludeIgnorableWhitespace(pThis->m_bPreserveWhiteSpace); - - - - if (!pThis->m_bParseError && !pThis->m_bAbort) { - // - // this brings the COM component into better mimicry to MSXML - // by not throwing a validation error when there is no DOCTYPE - // - parser.setValidationScheme(pThis->m_bThreadValidate ? AbstractDOMParser::Val_Auto : AbstractDOMParser::Val_Never); - } - - if (!pThis->m_bParseError && !pThis->m_bAbort) - parser.setErrorHandler(pThis); - - if (!pThis->m_bParseError && !pThis->m_bAbort) - pThis->m_pParseError->Reset(); - - if (!pThis->m_bParseError && !pThis->m_bAbort) - pThis->m_bParseError = false; - - try - { - if (!pThis->m_bParseError && !pThis->m_bAbort) { - if (pThis->m_FileName.length() > 0) - parser.parse(static_cast<LPCTSTR> (pThis->m_FileName)); - else { - XMLByte *pXMLByte = reinterpret_cast<XMLByte*> (static_cast<XMLCh*>(pThis->m_xml)); - MemBufInputSource memBufIS(pXMLByte,pThis->m_xml.length()*sizeof(XMLCh),OLESTR("IBMXMLParser"),false); - memBufIS.setEncoding(OLESTR("UTF-16LE")); - if (!pThis->m_bParseError && !pThis->m_bAbort) - parser.parse(memBufIS); - } - } - - } - catch(...) - { - pThis->m_bParseError = true; - return 0; - } - - if (!pThis->m_bParseError && !pThis->m_bAbort) - pThis->m_TmpDocument = parser.adoptDocument(); - - if (!pThis->m_bParseError && !pThis->m_bAbort && pThis->m_bAsync) - pThis->PostMessage(MSG_READY_STATE_CHANGE,4); - - return 0; -} - -STDMETHODIMP CXMLDOMDocument::save(VARIANT location) -{ - ATLTRACE(_T("CXMLDOMDocument::save\n")); - - if (V_VT(&location) != VT_BSTR) - return E_INVALIDARG; - - _bstr_t file(V_BSTR(&location)); - if (0 == file.length()) - return E_INVALIDARG; - - _bstr_t text; - - try { - DOMNodeList* childs = m_Document->getChildNodes(); - unsigned int length = childs->getLength(); - for (unsigned int i=0; i < length; ++i) { - DOMNode* child = childs->item(i); - _bstr_t nodeText; - GetXML(child,nodeText); - text += nodeText; - } - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - FILE* fp = _tfopen(file, "wt"); - if (fp == NULL) - return E_FAIL; - - if(text.length()>0 && _fputts(text, fp)<0) - { - fclose(fp); - return E_FAIL; - } - - if(fclose(fp)!=0) - return E_FAIL; - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::get_validateOnParse(VARIANT_BOOL *pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_validateOnParse\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = (m_bValidate) ? VARIANT_TRUE : VARIANT_FALSE; - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::put_validateOnParse(VARIANT_BOOL newVal) -{ - ATLTRACE(_T("CXMLDOMDocument::put_validateOnParse\n")); - m_bValidate = (VARIANT_TRUE == newVal) ? true : false; - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::get_resolveExternals(VARIANT_BOOL *pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_resolveExternals\n")); - - if (NULL == pVal) - return E_POINTER; - - return E_NOTIMPL; -} - -STDMETHODIMP CXMLDOMDocument::put_resolveExternals(VARIANT_BOOL newVal) -{ - ATLTRACE(_T("CXMLDOMDocument::put_resolveExternals\n")); - return E_NOTIMPL; -} - -STDMETHODIMP CXMLDOMDocument::get_preserveWhiteSpace(VARIANT_BOOL *pVal) -{ - ATLTRACE(_T("CXMLDOMDocument::get_preserveWhiteSpace\n")); - if (NULL == pVal) - return E_POINTER; - - *pVal = (m_bPreserveWhiteSpace) ? VARIANT_TRUE : VARIANT_FALSE; - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::put_preserveWhiteSpace(VARIANT_BOOL newVal) -{ - ATLTRACE(_T("CXMLDOMDocument::put_preserveWhiteSpace\n")); - m_bPreserveWhiteSpace = (VARIANT_TRUE == newVal) ? true : false; - return S_OK; - -} - -STDMETHODIMP CXMLDOMDocument::put_onreadystatechange(VARIANT newVal) -{ - ATLTRACE(_T("CXMLDOMDocument::put_onreadystatechange\n")); - - if (VT_DISPATCH != V_VT(&newVal) && - VT_NULL != V_VT(&newVal)) - return E_INVALIDARG; - - LPDISPATCH pDisp = NULL; - if (VT_DISPATCH == V_VT(&newVal)) - pDisp = V_DISPATCH(&newVal); - - if (m_pOnReadyStateChange != NULL) { - m_pOnReadyStateChange->Release(); - m_pOnReadyStateChange = NULL; - } - m_pOnReadyStateChange = pDisp; - if (m_pOnReadyStateChange != NULL) - m_pOnReadyStateChange->AddRef(); - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::put_ondataavailable(VARIANT newVal) -{ - ATLTRACE(_T("CXMLDOMDocument::put_ondataavailable\n")); - - if (VT_DISPATCH != V_VT(&newVal) && - VT_NULL != V_VT(&newVal)) - return E_INVALIDARG; - - LPDISPATCH pDisp = NULL; - if (VT_DISPATCH == V_VT(&newVal)) - pDisp = V_DISPATCH(&newVal); - - if (m_pOnDataAvailable != NULL) { - m_pOnDataAvailable->Release(); - m_pOnDataAvailable = NULL; - } - m_pOnDataAvailable = pDisp; - if (m_pOnDataAvailable != NULL) - m_pOnDataAvailable->AddRef(); - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocument::put_ontransformnode(VARIANT newVal) -{ - ATLTRACE(_T("CXMLDOMDocument::put_ontransformnode\n")); - - if (VT_DISPATCH != V_VT(&newVal) && - VT_NULL != V_VT(&newVal)) - return E_INVALIDARG; - - LPDISPATCH pDisp = NULL; - if (VT_DISPATCH == V_VT(&newVal)) - pDisp = V_DISPATCH(&newVal); - - if (m_pOnTransformNode != NULL) { - m_pOnTransformNode->Release(); - m_pOnTransformNode = NULL; - } - m_pOnTransformNode = pDisp; - if (m_pOnTransformNode != NULL) - m_pOnTransformNode->AddRef(); - - return S_OK; -} - diff --git a/src/xercesc/com/XMLDOMDocument.h b/src/xercesc/com/XMLDOMDocument.h deleted file mode 100644 index 90c321e6d..000000000 --- a/src/xercesc/com/XMLDOMDocument.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomdocument_h___ -#define ___xmldomdocument_h___ - -#include <xercesc/dom/DOMDocument.hpp> -#include "IXMLDOMNodeImpl.h" - -#include "resource.h" // main symbols -#include "XMLDOMParseError.h" - -#include <xercesc/sax/ErrorHandler.hpp> -#include "xml4comCP.h" - -XERCES_CPP_NAMESPACE_USE - -class XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException; - -class ATL_NO_VTABLE CXMLDOMDocument : - public CComObjectRootEx<CComSingleThreadModel>, - public CComCoClass<CXMLDOMDocument, &CLSID_DOMDocument>, - public IObjectSafetyImpl<CXMLDOMDocument, INTERFACESAFE_FOR_UNTRUSTED_CALLER>, - public IXMLDOMNodeImpl<IXMLDOMDocument, &IID_IXMLDOMDocument>, - public IObjectWithSiteImpl<CXMLDOMDocument>, - public CProxyXMLDOMDocumentEvents< CXMLDOMDocument >, - public IConnectionPointContainerImpl<CXMLDOMDocument>, - public IProvideClassInfo2Impl<&CLSID_DOMDocument, &DIID_XMLDOMDocumentEvents, &LIBID_Xerces, XERCES_VERSION_MAJOR, INVK_CAT2_RAW_NUMERIC(XERCES_VERSION_MINOR,XERCES_VERSION_REVISION)>, - public CWindowImpl<CXMLDOMDocument, CWindow, CWinTraits<0,0> >, - ErrorHandler -{ -public: - CXMLDOMDocument(); - - HRESULT FinalConstruct(); - void FinalRelease(); - - virtual DOMNode* get_DOMNode() { return m_Document;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_DOCUMENT; } - - virtual void resetErrors() {}; - - //DECLARE_REGISTRY_RESOURCEID(IDR_XMLDOCUMENT) - static HRESULT WINAPI UpdateRegistry(BOOL bRegister); - -DECLARE_NOT_AGGREGATABLE(CXMLDOMDocument) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMDocument) - COM_INTERFACE_ENTRY(IXMLDOMDocument) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IObjectSafety) - COM_INTERFACE_ENTRY(IObjectWithSite) - COM_INTERFACE_ENTRY(ISupportErrorInfo) - COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer) - COM_INTERFACE_ENTRY(IProvideClassInfo) - COM_INTERFACE_ENTRY(IProvideClassInfo2) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - -BEGIN_CONNECTION_POINT_MAP(CXMLDOMDocument) - CONNECTION_POINT_ENTRY(DIID_XMLDOMDocumentEvents) -END_CONNECTION_POINT_MAP() - - DECLARE_WND_CLASS(_T("XMLParseMonitor")) - -BEGIN_MSG_MAP(CMonitorWnd) - MESSAGE_HANDLER(MSG_READY_STATE_CHANGE, OnReadyStateChange) -END_MSG_MAP() - - LRESULT OnReadyStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - - // ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - - // IXMLDOMDocument methods - STDMETHOD(get_doctype)(IXMLDOMDocumentType * *pVal); - STDMETHOD(get_implementation)(IXMLDOMImplementation * *pVal); - STDMETHOD(get_documentElement)(IXMLDOMElement * *pVal); - STDMETHOD(putref_documentElement)(IXMLDOMElement *newVal); - STDMETHOD(createElement)(BSTR tagName, IXMLDOMElement * *element); - STDMETHOD(createDocumentFragment)(IXMLDOMDocumentFragment * *docFrag); - STDMETHOD(createTextNode)(BSTR data, IXMLDOMText * *text); - STDMETHOD(createComment)(BSTR data, IXMLDOMComment * *comment); - STDMETHOD(createCDATASection)(BSTR data, IXMLDOMCDATASection * *cdata); - STDMETHOD(createProcessingInstruction)(BSTR target, BSTR data, IXMLDOMProcessingInstruction * *pVal); - STDMETHOD(createAttribute)(BSTR name, IXMLDOMAttribute * *attr); - STDMETHOD(createEntityReference)(BSTR name, IXMLDOMEntityReference * *entityRef); - STDMETHOD(getElementsByTagName)(BSTR tagName, IXMLDOMNodeList * *resultList); - STDMETHOD(createNode)(VARIANT type, BSTR name, BSTR namespaceURI, IXMLDOMNode * *node); - STDMETHOD(nodeFromID)(BSTR idString, IXMLDOMNode * *node); - STDMETHOD(load)(VARIANT xmlSource, VARIANT_BOOL *isSuccessful); - STDMETHOD(get_readyState)(long *pVal); - STDMETHOD(get_parseError)(IXMLDOMParseError * *pVal); - STDMETHOD(get_url)(BSTR *pVal); - STDMETHOD(get_async)(VARIANT_BOOL *pVal); - STDMETHOD(put_async)(VARIANT_BOOL newVal); - STDMETHOD(abort)(void); - STDMETHOD(loadXML)(BSTR bstrXML, VARIANT_BOOL *success); - STDMETHOD(save)(VARIANT location); - STDMETHOD(get_validateOnParse)(VARIANT_BOOL *pVal); - STDMETHOD(put_validateOnParse)(VARIANT_BOOL newVal); - STDMETHOD(get_resolveExternals)(VARIANT_BOOL *pVal); - STDMETHOD(put_resolveExternals)(VARIANT_BOOL newVal); - STDMETHOD(get_preserveWhiteSpace)(VARIANT_BOOL *pVal); - STDMETHOD(put_preserveWhiteSpace)(VARIANT_BOOL newVal); - STDMETHOD(put_onreadystatechange)(VARIANT newVal); - STDMETHOD(put_ondataavailable)(VARIANT newVal); - STDMETHOD(put_ontransformnode)(VARIANT newVal); - - // Error handling - virtual void warning(const SAXParseException& exc); - virtual void error(const SAXParseException& exc); - virtual void fatalError(const SAXParseException& exc); - - bool IsAbort() const { return m_bAbort; } - - XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* m_Document; - -private: - - bool m_bValidate; - long m_lReadyState; - _bstr_t m_url; - CXMLDOMParseErrorObj *m_pParseError; - bool m_bAsync; - bool m_bAbort; - HANDLE m_hParseThread; - LPDISPATCH m_pOnReadyStateChange; - LPDISPATCH m_pOnDataAvailable; - LPDISPATCH m_pOnTransformNode; - - // thread data - _bstr_t m_FileName; - _bstr_t m_xml; - XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* m_TmpDocument; - bool m_bParseError; - bool m_bThreadValidate; - bool m_bPreserveWhiteSpace; - - HRESULT GetBaseURL(_bstr_t &baseURL); - - static UINT APIENTRY ParseThread(void *pParm); -}; - -typedef CComObject<CXMLDOMDocument> CXMLDOMDocumentObj; - -#endif // ___xmldomdocument_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMDocumentFragment.h b/src/xercesc/com/XMLDOMDocumentFragment.h deleted file mode 100644 index 6ea524009..000000000 --- a/src/xercesc/com/XMLDOMDocumentFragment.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomdocumentfragment_h___ -#define ___xmldomdocumentfragment_h___ - -#include <xercesc/dom/DOMDocumentFragment.hpp> -#include "IXMLDOMNodeImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMDocumentFragment : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMDocumentFragment, &IID_IXMLDOMDocumentFragment> -{ -public: - CXMLDOMDocumentFragment() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return documentFragment;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_DOCUMENT_FRAGMENT; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMDocumentFragment) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMDocumentFragment) - COM_INTERFACE_ENTRY(IXMLDOMDocumentFragment) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - DOMDocumentFragment* documentFragment; -}; - -typedef CComObject<CXMLDOMDocumentFragment> CXMLDOMDocumentFragmentObj; - -#endif // ___xmldomdocumentfragment_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMDocumentType.cpp b/src/xercesc/com/XMLDOMDocumentType.cpp deleted file mode 100644 index 95be0c711..000000000 --- a/src/xercesc/com/XMLDOMDocumentType.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMDocumentType.h" -#include "XMLDOMNamedNodeMap.h" - -// IXMLDOMDocumentType methods -STDMETHODIMP CXMLDOMDocumentType::get_name(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMDocumentType::get_name\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(documentType->getName()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHODIMP CXMLDOMDocumentType::get_entities(IXMLDOMNamedNodeMap **pVal) -{ - ATLTRACE(_T("CXMLDOMDocumentType::get_entities\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMNamedNodeMapObj *pObj = NULL; - HRESULT hr = CXMLDOMNamedNodeMapObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - - try - { - pObj->m_container = documentType->getEntities(); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMNamedNodeMap, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMDocumentType::get_notations(IXMLDOMNamedNodeMap **pVal) -{ - ATLTRACE(_T("CXMLDOMDocumentType::get_notations\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMNamedNodeMapObj *pObj = NULL; - HRESULT hr = CXMLDOMNamedNodeMapObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - - try - { - pObj->m_container = documentType->getNotations(); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMNamedNodeMap, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; - -} \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMDocumentType.h b/src/xercesc/com/XMLDOMDocumentType.h deleted file mode 100644 index 83d7d6d47..000000000 --- a/src/xercesc/com/XMLDOMDocumentType.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomdocumenttype_h___ -#define ___xmldomdocumenttype_h___ - -#include <xercesc/dom/DOMDocumentType.hpp> -#include "IXMLDOMNodeImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMDocumentType : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMDocumentType, &IID_IXMLDOMDocumentType> -{ -public: - CXMLDOMDocumentType() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return documentType;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_DOCUMENT_TYPE; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMDocumentType) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMDocumentType) - COM_INTERFACE_ENTRY(IXMLDOMDocumentType) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - // IXMLDOMDocumentType methods - STDMETHOD(get_name)(BSTR *pVal); - STDMETHOD(get_entities)(IXMLDOMNamedNodeMap * *pVal); - STDMETHOD(get_notations)(IXMLDOMNamedNodeMap * *pVal); - - DOMDocumentType* documentType; -}; - -typedef CComObject<CXMLDOMDocumentType> CXMLDOMDocumentTypeObj; - -#endif // ___xmldomdocumenttype_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMElement.cpp b/src/xercesc/com/XMLDOMElement.cpp deleted file mode 100644 index 89f9862d1..000000000 --- a/src/xercesc/com/XMLDOMElement.cpp +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMElement.h" -#include "XMLDOMAttribute.h" -#include "XMLDOMNodeList.h" - -// IXMLDOMElement methods -STDMETHODIMP CXMLDOMElement::get_tagName(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMElement::get_tagName\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(element->getTagName()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMElement::getAttribute(BSTR name, VARIANT *pVal) -{ - ATLTRACE(_T("CXMLDOMElement::getAttribute\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - V_VT(pVal) = VT_EMPTY; - - try { - V_VT(pVal) = VT_BSTR; - V_BSTR(pVal) = SysAllocString(element->getAttribute(name)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMElement::setAttribute(BSTR name, VARIANT value) -{ - ATLTRACE(_T("CXMLDOMElement::setAttribute\n")); - - try - { - if (V_VT(&value) == VT_BSTR) - { - element->setAttribute(name, value.bstrVal); - } - else { - element->setAttribute(name,(BSTR) (_bstr_t) value); - } - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHODIMP CXMLDOMElement::removeAttribute(BSTR name) -{ - ATLTRACE(_T("CXMLDOMElement::removeAttribute\n")); - - try - { - element->removeAttribute(name); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMElement::getAttributeNode(BSTR name, IXMLDOMAttribute **attr) -{ - ATLTRACE(_T("CXMLDOMElement::getAttributeNode\n")); - - if (NULL == attr) - return E_POINTER; - - *attr = NULL; - DOMAttr* attrNode=element->getAttributeNode(name); - if(attrNode==NULL) - return S_OK; - - - CXMLDOMAttributeObj *pObj = NULL; - HRESULT hr = CXMLDOMAttributeObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - - try - { - pObj->attr = attrNode; - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMAttribute, reinterpret_cast<LPVOID*> (attr)); - if (S_OK != hr) - *attr = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMElement::setAttributeNode(IXMLDOMAttribute *attr, IXMLDOMAttribute **attributeNode) -{ - ATLTRACE(_T("CXMLDOMElement::setAttributeNode\n")); - - if (NULL == attr || NULL == attributeNode) - return E_POINTER; - - *attributeNode = NULL; - - DOMAttr* newAttr = NULL; - IIBMXMLDOMNodeIdentity* nodeID = NULL; - HRESULT sc = attr->QueryInterface(IID_IIBMXMLDOMNodeIdentity,(void**) &nodeID); - if(SUCCEEDED(sc)) { - long id = 0; - sc = nodeID->get_NodeId(&id); - nodeID->Release(); - if(SUCCEEDED(sc)) { - // - // any subsequent failure will be reported as an invalid arg - // - sc = E_INVALIDARG; - try { - DOMNode* newNode = (DOMNode*) id; - if(newNode->getNodeType() == DOMNode::ATTRIBUTE_NODE) { - newAttr = (DOMAttr*) newNode; - } - } - catch(...) { - } - } - } - - // - // if we couldn't extract an attribute out of the - // argument, then return with a failure code - if(newAttr == NULL) return sc; - - sc = S_OK; - try - { - DOMAttr* oldAttr = element->setAttributeNode(newAttr); - if(oldAttr!=NULL) { - CXMLDOMAttributeObj *pObj = NULL; - sc = CXMLDOMAttributeObj::CreateInstance(&pObj); - if (SUCCEEDED(sc)) { - pObj->attr = oldAttr; - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - - sc = pObj->QueryInterface(IID_IXMLDOMAttribute, reinterpret_cast<LPVOID*> (attributeNode)); - pObj->Release(); - } - } - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return sc; -} - -STDMETHODIMP CXMLDOMElement::removeAttributeNode(IXMLDOMAttribute *attr, IXMLDOMAttribute * *attributeNode) -{ - ATLTRACE(_T("CXMLDOMElement::removeAttributeNode\n")); - - if (NULL == attr || NULL == attributeNode) - return E_POINTER; - - *attributeNode = NULL; - - CXMLDOMAttributeObj *pObj = NULL; - HRESULT hr = CXMLDOMAttributeObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - - try - { - long id = 0; - IIBMXMLDOMNodeIdentity* nodeID = NULL; - if(SUCCEEDED(attr->QueryInterface(IID_IIBMXMLDOMNodeIdentity,(void**) &nodeID))) { - nodeID->get_NodeId(&id); - nodeID->Release(); - } - pObj->attr = element->removeAttributeNode((DOMAttr*) id); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMAttribute, reinterpret_cast<LPVOID*> (attributeNode)); - if (S_OK != hr) - *attributeNode = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMElement::getElementsByTagName(BSTR tagName, IXMLDOMNodeList **pVal) -{ - ATLTRACE(_T("CXMLDOMElement::getElementsByTagName\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CXMLDOMNodeListObj *pObj = NULL; - HRESULT hr = CXMLDOMNodeListObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(m_pIXMLDOMDocument); - - try - { - pObj->m_container = element->getElementsByTagName(tagName); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(IID_IXMLDOMNodeList, reinterpret_cast<LPVOID*> (pVal)); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - return hr; -} - -STDMETHODIMP CXMLDOMElement::normalize(void) -{ - ATLTRACE(_T("CXMLDOMElement::normalize\n")); - - try - { - element->normalize(); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} diff --git a/src/xercesc/com/XMLDOMElement.h b/src/xercesc/com/XMLDOMElement.h deleted file mode 100644 index 41d8ecb9a..000000000 --- a/src/xercesc/com/XMLDOMElement.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomelement_h___ -#define ___xmldomelement_h___ - -#include <xercesc/dom/DOMElement.hpp> -#include "IXMLDOMNodeImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMElement : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMElement, &IID_IXMLDOMElement> -{ -public: - CXMLDOMElement() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return element;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_ELEMENT; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMElement) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMElement) - COM_INTERFACE_ENTRY(IXMLDOMElement) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - // IXMLDOMElement methods - STDMETHOD(get_tagName)(BSTR *pVal); - STDMETHOD(getAttribute)(BSTR name, VARIANT *value); - STDMETHOD(setAttribute)(BSTR name, VARIANT value); - STDMETHOD(removeAttribute)(BSTR name); - STDMETHOD(getAttributeNode)(BSTR name, IXMLDOMAttribute * *attr); - STDMETHOD(setAttributeNode)(IXMLDOMAttribute *attr, IXMLDOMAttribute * *attributeNode); - STDMETHOD(removeAttributeNode)(IXMLDOMAttribute *attr, IXMLDOMAttribute * *attributeNode); - STDMETHOD(getElementsByTagName)(BSTR tagName, IXMLDOMNodeList * *resultList); - STDMETHOD(normalize)(void); - - DOMElement* element; -}; - -typedef CComObject<CXMLDOMElement> CXMLDOMElementObj; - -#endif // ___xmldomelement_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMEntity.cpp b/src/xercesc/com/XMLDOMEntity.cpp deleted file mode 100644 index 6c985e75f..000000000 --- a/src/xercesc/com/XMLDOMEntity.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMEntity.h" - -// IXMLDOMEntity methods -STDMETHODIMP CXMLDOMEntity::get_publicId(VARIANT *pVal) -{ - ATLTRACE(_T("CXMLDOMEntity::get_publicId\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - - try - { - const XMLCh* val=entity->getPublicId(); - if(val == NULL) - { - V_VT(pVal) = VT_NULL; - } - else - { - V_VT(pVal) = VT_BSTR; - V_BSTR(pVal) = SysAllocString(val); - } - } - catch(DOMException& ex) { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMEntity::get_systemId(VARIANT *pVal) -{ - ATLTRACE(_T("CXMLDOMEntity::get_systemId\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - - try - { - const XMLCh* val=entity->getSystemId(); - if(val == NULL) - { - V_VT(pVal) = VT_NULL; - } - else - { - V_VT(pVal) = VT_BSTR; - V_BSTR(pVal) = SysAllocString(val); - } - } - catch(DOMException& ex) { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMEntity::get_notationName(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMEntity::get_notationName\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(entity->getNotationName()); - } - catch(DOMException& ex) { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} diff --git a/src/xercesc/com/XMLDOMEntity.h b/src/xercesc/com/XMLDOMEntity.h deleted file mode 100644 index 308fc0470..000000000 --- a/src/xercesc/com/XMLDOMEntity.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomentity_h___ -#define ___xmldomentity_h___ - -#include <xercesc/dom/DOMEntity.hpp> -#include "IXMLDOMNodeImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMEntity : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMEntity, &IID_IXMLDOMEntity> -{ -public: - CXMLDOMEntity() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return entity;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_ENTITY; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMEntity) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMEntity) - COM_INTERFACE_ENTRY(IXMLDOMEntity) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - - // IXMLDOMEntity methods - STDMETHOD(get_publicId)(VARIANT *pVal); - STDMETHOD(get_systemId)(VARIANT *pVal); - STDMETHOD(get_notationName)(BSTR *pVal); - - DOMEntity* entity; -}; - -typedef CComObject<CXMLDOMEntity> CXMLDOMEntityObj; - -#endif // ___xmldomentity_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMEntityReference.h b/src/xercesc/com/XMLDOMEntityReference.h deleted file mode 100644 index e4f46ef6c..000000000 --- a/src/xercesc/com/XMLDOMEntityReference.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomentityreference_h___ -#define ___xmldomentityreference_h___ - -#include <xercesc/dom/DOMEntityReference.hpp> -#include "IXMLDOMNodeImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMEntityReference : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMEntityReference, &IID_IXMLDOMEntityReference> -{ -public: - CXMLDOMEntityReference() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return entityReference;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_ENTITY_REFERENCE; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMEntityReference) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMEntityReference) - COM_INTERFACE_ENTRY(IXMLDOMEntityReference) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - DOMEntityReference* entityReference; -}; - -typedef CComObject<CXMLDOMEntityReference> CXMLDOMEntityReferenceObj; - -#endif // ___xmldomentityreference_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMImplementation.cpp b/src/xercesc/com/XMLDOMImplementation.cpp deleted file mode 100644 index e2016ed72..000000000 --- a/src/xercesc/com/XMLDOMImplementation.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMImplementation.h" - -STDMETHODIMP CXMLDOMImplementation::hasFeature(BSTR feature, BSTR ver, VARIANT_BOOL *pVal) -{ - ATLTRACE(_T("CXMLDOMImplementation::hasFeature\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = VARIANT_FALSE; - - try - { - *pVal = (implementation->hasFeature(feature, ver) ? VARIANT_TRUE : VARIANT_FALSE); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMImplementation.h b/src/xercesc/com/XMLDOMImplementation.h deleted file mode 100644 index 3e69b40f2..000000000 --- a/src/xercesc/com/XMLDOMImplementation.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomimplementation_h___ -#define ___xmldomimplementation_h___ - -#include <xercesc/dom/DOMImplementation.hpp> - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMImplementation : - public CComObjectRootEx<CComSingleThreadModel>, - public IDispatchImpl<IXMLDOMImplementation, &IID_IXMLDOMImplementation, &LIBID_Xerces, XERCES_VERSION_MAJOR, INVK_CAT2_RAW_NUMERIC(XERCES_VERSION_MINOR,XERCES_VERSION_REVISION)> -{ -public: - CXMLDOMImplementation() - {} - -DECLARE_NOT_AGGREGATABLE(CXMLDOMImplementation) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMImplementation) - COM_INTERFACE_ENTRY(IXMLDOMImplementation) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - - // IXMLDOMImplementation methods - STDMETHOD(hasFeature)(BSTR feature, BSTR ver, VARIANT_BOOL *pVal); - - DOMImplementation* implementation; -}; - -typedef CComObject<CXMLDOMImplementation> CXMLDOMImplementationObj; - -#endif // ___xmldomimplemenation_h___ diff --git a/src/xercesc/com/XMLDOMNamedNodeMap.cpp b/src/xercesc/com/XMLDOMNamedNodeMap.cpp deleted file mode 100644 index bfc924817..000000000 --- a/src/xercesc/com/XMLDOMNamedNodeMap.cpp +++ /dev/null @@ -1,342 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMNamedNodeMap.h" -#include "XMLDOMUtil.h" -#include "IXMLDOMNodeImpl.h" - -typedef CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT>, NodeContainerImpl<DOMNamedNodeMap> > - CComEnumUnknownOnNamedNodeContainer; - -STDMETHODIMP CXMLDOMNamedNodeMap::getNamedItem(BSTR name, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::getNamedItem\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - HRESULT hr = S_OK; - - if (m_container == 0) - return S_OK; - - try - { - DOMNode* n = m_container->getNamedItem(name); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return hr; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::setNamedItem(IXMLDOMNode *newItem, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::setNamedItem\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - if (m_container == 0) - return S_OK; - - if (NULL == newItem) - return E_INVALIDARG; - - CComQIPtr<IIBMXMLDOMNodeIdentity,&IID_IIBMXMLDOMNodeIdentity> pNewItem(newItem); - if (!pNewItem) - return E_NOINTERFACE; - - long id = 0; - HRESULT hr = pNewItem->get_NodeId(&id); - if (S_OK != hr) - return hr; - - DOMNode *pNewItemNode = reinterpret_cast<DOMNode*> (id); - if (NULL == pNewItemNode) - return E_INVALIDARG; - - try - { - const XMLCh* name = pNewItemNode->getNodeName(); - // - // returns old node - // - DOMNode* n = m_container->setNamedItem(pNewItemNode); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return hr; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::removeNamedItem(BSTR name, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::removeNamedItem\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - HRESULT hr = S_OK; - - if (m_container == 0) - return S_OK; - - try - { - DOMNode* n = m_container->removeNamedItem(name); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - // - // if we had a failure, return success anyway - // - catch(...) - { - } - - return hr; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::get_item(long index, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::get_item\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - HRESULT hr = S_OK; - - try - { - if (m_container == 0 || index < 0) - return E_INVALIDARG; - - long length = m_container->getLength(); - if (index < length) - hr = wrapNode(m_pIXMLDOMDocument,m_container->item(index),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return hr; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::get_length(long *pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::get_length\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = 0; - - if (m_container == 0) - return S_OK; - - try - { - *pVal = m_container->getLength(); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::getQualifiedItem(BSTR baseName, BSTR namespaceURI, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::getQualifiedItem\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - if (m_container == 0) - return S_OK; - - HRESULT hr = S_OK; - - try - { - DOMNode* n = m_container->getNamedItemNS(namespaceURI,baseName); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::removeQualifiedItem(BSTR baseName, BSTR namespaceURI, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::removeQualifiedItem\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - if (m_container == 0) - return S_OK; - - HRESULT hr = S_OK; - - try - { - DOMNode* n = m_container->removeNamedItemNS(namespaceURI,baseName); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::nextNode(IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::nextNode\n")); - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - if (m_container == 0) - return S_OK; - - int length = m_container->getLength(); - if (0 == length) - return S_OK; - - if (m_NextNodeIndex >= length) - return S_OK; - - HRESULT hr = S_OK; - - try - { - DOMNode* n = m_container->item(m_NextNodeIndex); - if(n!=NULL) - hr = wrapNode(m_pIXMLDOMDocument,n,IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - ++m_NextNodeIndex; - - return hr; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::reset() -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::reset\n")); - - m_NextNodeIndex = 0; - - return S_OK; -} - -STDMETHODIMP CXMLDOMNamedNodeMap::get__newEnum(IUnknown **pVal) -{ - ATLTRACE(_T("CXMLDOMNamedNodeMap::get__newEnum\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CComObject<CComEnumUnknownOnNamedNodeContainer> *pe = NULL; - HRESULT hr = CComObject<CComEnumUnknownOnNamedNodeContainer>::CreateInstance(&pe); - if (S_OK != hr) - return hr; - - pe->AddRef(); - - hr = pe->Init(GetUnknown(),*this); - if (S_OK == hr) - hr = pe->QueryInterface(pVal); - - pe->Release(); - - return hr; -} - -HRESULT CXMLDOMNamedNodeMap::InterfaceSupportsErrorInfo(REFIID riid) -{ - if(riid == IID_IXMLDOMNamedNodeMap) return S_OK; - return S_FALSE; -} \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMNamedNodeMap.h b/src/xercesc/com/XMLDOMNamedNodeMap.h deleted file mode 100644 index 6fe48fd01..000000000 --- a/src/xercesc/com/XMLDOMNamedNodeMap.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomnamednodemap_h___ -#define ___xmldomnamednodemap_h___ - -#include <xercesc/dom/DOMNamedNodeMap.hpp> -#include "NodeContainerImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMNamedNodeMap : - public CComObjectRootEx<CComSingleThreadModel>, - public IDispatchImpl<IXMLDOMNamedNodeMap, &IID_IXMLDOMNamedNodeMap, &LIBID_Xerces, XERCES_VERSION_MAJOR, INVK_CAT2_RAW_NUMERIC(XERCES_VERSION_MINOR,XERCES_VERSION_REVISION)>, - public NodeContainerImpl<DOMNamedNodeMap>, - public ISupportErrorInfo -{ -public: - CXMLDOMNamedNodeMap() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMNamedNodeMap) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMNamedNodeMap) - COM_INTERFACE_ENTRY(IXMLDOMNamedNodeMap) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - - // ISupportErrorInfo - HRESULT STDMETHODCALLTYPE InterfaceSupportsErrorInfo(REFIID iid); - - // IXMLDOMNamedNodeMap methods - STDMETHOD(getNamedItem)(BSTR name, IXMLDOMNode * *namedItem); - STDMETHOD(setNamedItem)(IXMLDOMNode *newItem, IXMLDOMNode * *nameItem); - STDMETHOD(removeNamedItem)(BSTR name, IXMLDOMNode * *namedItem); - STDMETHOD(get_item)(long index, IXMLDOMNode * *pVal); - STDMETHOD(get_length)(long *pVal); - STDMETHOD(getQualifiedItem)(BSTR baseName, BSTR namespaceURI, IXMLDOMNode * *node); - STDMETHOD(removeQualifiedItem)(BSTR baseName, BSTR namespaceURI, IXMLDOMNode * *node); - STDMETHOD(nextNode)(IXMLDOMNode * *nextItem); - STDMETHOD(reset)(); - STDMETHOD(get__newEnum)(IUnknown * *pVal); -}; - -typedef CComObject<CXMLDOMNamedNodeMap> CXMLDOMNamedNodeMapObj; - -#endif // ___xmldomnamednodemap_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMNodeList.cpp b/src/xercesc/com/XMLDOMNodeList.cpp deleted file mode 100644 index a9de4163c..000000000 --- a/src/xercesc/com/XMLDOMNodeList.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMNodeList.h" -#include "XMLDOMUtil.h" -#include "IXMLDOMNodeImpl.h" - -typedef CComEnumOnSTL<IEnumVARIANT, &IID_IEnumVARIANT, VARIANT, _Copy<VARIANT>,NodeContainerImpl<DOMNodeList> > - CComEnumUnknownOnNodeContainer; - -STDMETHODIMP CXMLDOMNodeList::get_item(long index, IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNodeList::get_item\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - HRESULT hr = S_OK; - - try - { - if (m_container == 0 || index < 0) - return E_INVALIDARG; - - long length = m_container->getLength(); - // - // if index is beyond end - // return a null object not an exception - // - if (index < length) - hr = wrapNode(m_pIXMLDOMDocument,m_container->item(index),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - - catch(...) - { - return E_FAIL; - } - - return hr; -} - -STDMETHODIMP CXMLDOMNodeList::get_length(long *pVal) -{ - ATLTRACE(_T("CXMLDOMNodeList::get_length\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = 0; - - if (m_container == 0) - return S_OK; - - try - { - *pVal = m_container->getLength(); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMNodeList::nextNode(IXMLDOMNode **pVal) -{ - ATLTRACE(_T("CXMLDOMNodeList::nextNode\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - if (m_container == 0) - return S_OK; - - int length = m_container->getLength(); - if (0 == length) - return S_OK; - - if (m_NextNodeIndex >= length) - return S_OK; - - - HRESULT hr = S_OK; - - try - { - hr = wrapNode(m_pIXMLDOMDocument,m_container->item(m_NextNodeIndex),IID_IXMLDOMNode, reinterpret_cast<LPVOID *> (pVal)); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - ++m_NextNodeIndex; - - return hr; -} - -STDMETHODIMP CXMLDOMNodeList::reset() -{ - ATLTRACE(_T("CXMLDOMNodeList::reset\n")); - - m_NextNodeIndex = 0; - - return S_OK; -} - -STDMETHODIMP CXMLDOMNodeList::get__newEnum(IUnknown **pVal) -{ - ATLTRACE(_T("CXMLDOMNodeList::get__newEnum\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - CComObject<CComEnumUnknownOnNodeContainer> *pe = NULL; - HRESULT hr = CComObject<CComEnumUnknownOnNodeContainer>::CreateInstance(&pe); - if (S_OK != hr) - return hr; - - pe->AddRef(); - - hr = pe->Init(GetUnknown(),*this); - if (S_OK == hr) - hr = pe->QueryInterface(pVal); - - pe->Release(); - - return hr; -} - - -HRESULT CXMLDOMNodeList::InterfaceSupportsErrorInfo(REFIID riid) -{ - if(riid == IID_IXMLDOMNodeList) return S_OK; - return S_FALSE; -} \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMNodeList.h b/src/xercesc/com/XMLDOMNodeList.h deleted file mode 100644 index 20821ca10..000000000 --- a/src/xercesc/com/XMLDOMNodeList.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomnodelist_h___ -#define ___xmldomnodelist_h___ - -#include <xercesc/dom/DOMNodeList.hpp> -#include "NodeContainerImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMNodeList : - public CComObjectRootEx<CComSingleThreadModel>, - public IDispatchImpl<IXMLDOMNodeList, &IID_IXMLDOMNodeList, &LIBID_Xerces, XERCES_VERSION_MAJOR, INVK_CAT2_RAW_NUMERIC(XERCES_VERSION_MINOR,XERCES_VERSION_REVISION)>, - public NodeContainerImpl<DOMNodeList>, - public ISupportErrorInfo -{ -public: - CXMLDOMNodeList() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMNodeList) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMNodeList) - COM_INTERFACE_ENTRY(IXMLDOMNodeList) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - // ISupportErrorInfo - HRESULT STDMETHODCALLTYPE InterfaceSupportsErrorInfo(REFIID iid); - - - // IXMLDOMNodeList - STDMETHOD(get_item)(long index, IXMLDOMNode **pVal); - STDMETHOD(get_length)(long *pVal); - STDMETHOD(nextNode)(IXMLDOMNode **nextItem); - STDMETHOD(reset)(); - STDMETHOD(get__newEnum)(IUnknown **pVal); -}; -typedef CComObject<CXMLDOMNodeList> CXMLDOMNodeListObj; - -#endif // ___xmldomnodelist_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMNotation.cpp b/src/xercesc/com/XMLDOMNotation.cpp deleted file mode 100644 index 40d2d2860..000000000 --- a/src/xercesc/com/XMLDOMNotation.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMNotation.h" - -STDMETHODIMP CXMLDOMNotation::get_publicId(VARIANT *pVal) -{ - ATLTRACE(_T("CXMLDOMNotation::get_publicId\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - - try - { - const XMLCh* val=notation->getPublicId(); - if(val == NULL) - { - V_VT(pVal) = VT_NULL; - } - else - { - V_VT(pVal) = VT_BSTR; - V_BSTR(pVal) = SysAllocString(val); - } - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} - -STDMETHODIMP CXMLDOMNotation::get_systemId(VARIANT *pVal) -{ - ATLTRACE(_T("CXMLDOMNotation::get_systemId\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - - try - { - const XMLCh* val=notation->getSystemId(); - if(val == NULL) - { - V_VT(pVal) = VT_NULL; - } - else - { - V_VT(pVal) = VT_BSTR; - V_BSTR(pVal) = SysAllocString(val); - } - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - - return S_OK; -} diff --git a/src/xercesc/com/XMLDOMNotation.h b/src/xercesc/com/XMLDOMNotation.h deleted file mode 100644 index 26b9046a4..000000000 --- a/src/xercesc/com/XMLDOMNotation.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomnotation_h___ -#define ___xmldomnotation_h___ - -#include <xercesc/dom/DOMNotation.hpp> -#include "IXMLDOMNodeImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMNotation : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMNotation, &IID_IXMLDOMNotation> -{ -public: - CXMLDOMNotation() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return notation;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_NOTATION; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMNotation) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMNotation) - COM_INTERFACE_ENTRY(IXMLDOMNotation) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - // IXMLDOMNotation methods - STDMETHOD(get_publicId)(VARIANT *pVal); - STDMETHOD(get_systemId)(VARIANT *pVal); - - DOMNotation* notation; -}; - -typedef CComObject<CXMLDOMNotation> CXMLDOMNotationObj; - -#endif // ___xmldomnotation_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMParseError.cpp b/src/xercesc/com/XMLDOMParseError.cpp deleted file mode 100644 index a28dd400b..000000000 --- a/src/xercesc/com/XMLDOMParseError.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMParseError.h" - -HRESULT CXMLDOMParseError::FinalConstruct() -{ - m_CS.Init(); - return S_OK; -} - -void CXMLDOMParseError::FinalRelease() -{ - m_CS.Term(); -} - -void CXMLDOMParseError::SetData( long code, - const _bstr_t &url, - const _bstr_t &reason, - const _bstr_t &source, - long lineNumber, - long linePos, - long filePos) -{ - m_CS.Lock(); - m_Code = code; - m_url = url; - m_Reason = reason; - m_Source = source; - m_LineNumber = lineNumber; - m_LinePos = linePos; - m_FilePos = filePos; - m_CS.Unlock(); -} - -void CXMLDOMParseError::Reset() -{ - m_CS.Lock(); - m_Code = 0; - m_url = _T(""); - m_Reason = _T(""); - m_Source = _T(""); - m_LineNumber = 0; - m_LinePos = 0; - m_FilePos = 0; - m_CS.Unlock(); -} - -// IXMLDOMParseError methods -STDMETHODIMP CXMLDOMParseError::get_errorCode(long *pVal) -{ - ATLTRACE(_T("CXMLDOMParseError::get_errorCode\n")); - - if (NULL == pVal) - return E_POINTER; - - m_CS.Lock(); - *pVal = m_Code; - m_CS.Unlock(); - - return S_OK; -} - -STDMETHODIMP CXMLDOMParseError::get_url(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMParseError::get_url\n")); - - if (NULL == pVal) - return E_POINTER; - - m_CS.Lock(); - *pVal = m_url.copy(); - m_CS.Unlock(); - - return S_OK; -} - -STDMETHODIMP CXMLDOMParseError::get_reason(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMParseError::get_reason\n")); - - if (NULL == pVal) - return E_POINTER; - - m_CS.Lock(); - *pVal = m_Reason.copy(); - m_CS.Unlock(); - - return S_OK; -} - -STDMETHODIMP CXMLDOMParseError::get_srcText(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMParseError::get_srcText\n")); - - if (NULL == pVal) - return E_POINTER; - - m_CS.Lock(); - *pVal = m_Source.copy(); - m_CS.Unlock(); - - return S_OK; -} - -STDMETHODIMP CXMLDOMParseError::get_line(long *pVal) -{ - ATLTRACE(_T("CXMLDOMParseError::get_line\n")); - - if (NULL == pVal) - return E_POINTER; - - m_CS.Lock(); - *pVal = m_LineNumber; - m_CS.Unlock(); - - return S_OK; -} - -STDMETHODIMP CXMLDOMParseError::get_linepos(long *pVal) -{ - ATLTRACE(_T("CXMLDOMParseError::get_linepos\n")); - - if (NULL == pVal) - return E_POINTER; - - m_CS.Lock(); - *pVal = m_LinePos; - m_CS.Unlock(); - - return S_OK; -} - -STDMETHODIMP CXMLDOMParseError::get_filepos(long *pVal) -{ - ATLTRACE(_T("CXMLDOMParseError::get_filepos\n")); - - if (NULL == pVal) - return E_POINTER; - - m_CS.Lock(); - *pVal = m_FilePos; - m_CS.Unlock(); - - return S_OK; -} - diff --git a/src/xercesc/com/XMLDOMParseError.h b/src/xercesc/com/XMLDOMParseError.h deleted file mode 100644 index d68630ebf..000000000 --- a/src/xercesc/com/XMLDOMParseError.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomparseerror_h___ -#define ___xmldomparseerror_h___ - -#include <xercesc/util/XercesDefs.hpp> -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMParseError : - public CComObjectRootEx<CComSingleThreadModel>, - public IDispatchImpl<IXMLDOMParseError, &IID_IXMLDOMParseError, &LIBID_Xerces, XERCES_VERSION_MAJOR, INVK_CAT2_RAW_NUMERIC(XERCES_VERSION_MINOR,XERCES_VERSION_REVISION)> -{ -public: - CXMLDOMParseError() - :m_Code (0) - ,m_url (_T("")) - ,m_Reason (_T("")) - ,m_Source (_T("")) - ,m_LineNumber(0) - ,m_LinePos (0) - ,m_FilePos (0) - {} - - HRESULT FinalConstruct(); - void FinalRelease(); - -DECLARE_NOT_AGGREGATABLE(CXMLDOMParseError) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMParseError) - COM_INTERFACE_ENTRY(IXMLDOMParseError) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - - // IXMLDOMParseError methods - STDMETHOD(get_errorCode)(/* [out][retval] */ long *errorCode); - STDMETHOD(get_url)(/* [out][retval] */ BSTR *urlString); - STDMETHOD(get_reason)(/* [out][retval] */ BSTR *reasonString); - STDMETHOD(get_srcText)(/* [out][retval] */ BSTR *sourceString); - STDMETHOD(get_line)(/* [out][retval] */ long *lineNumber); - STDMETHOD(get_linepos)(/* [out][retval] */ long *linePosition); - STDMETHOD(get_filepos)(/* [out][retval] */ long *filePosition); - - void SetData(long code, - const _bstr_t &url, - const _bstr_t &reason, - const _bstr_t &source, - long lineNumber, - long linePos, - long filePos); - void Reset(); - -private: - - long m_Code; - _bstr_t m_url; - _bstr_t m_Reason; - _bstr_t m_Source; - long m_LineNumber; - long m_LinePos; - long m_FilePos; - - CComCriticalSection m_CS; -}; - -typedef CComObject<CXMLDOMParseError> CXMLDOMParseErrorObj; - -#endif // ___xmldomparseerror_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMProcessingInstruction.cpp b/src/xercesc/com/XMLDOMProcessingInstruction.cpp deleted file mode 100644 index e9c6d383a..000000000 --- a/src/xercesc/com/XMLDOMProcessingInstruction.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMProcessingInstruction.h" - -// IXMLDOMProcessingInstruction methods -STDMETHODIMP CXMLDOMProcessingInstruction::get_target(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMProcessingInstruction::get_target\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(processingInstruction->getTarget()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMProcessingInstruction::get_data(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMProcessingInstruction::get_data\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(processingInstruction->getData()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; - -} - -STDMETHODIMP CXMLDOMProcessingInstruction::put_data(BSTR newVal) -{ - ATLTRACE(_T("CXMLDOMProcessingInstruction::put_data\n")); - - try - { - processingInstruction->setData(newVal); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} diff --git a/src/xercesc/com/XMLDOMProcessingInstruction.h b/src/xercesc/com/XMLDOMProcessingInstruction.h deleted file mode 100644 index d46dbcef2..000000000 --- a/src/xercesc/com/XMLDOMProcessingInstruction.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomprocessinginstruction_h___ -#define ___xmldomprocessinginstruction_h___ - -#include <xercesc/dom/DOMProcessingInstruction.hpp> -#include "IXMLDOMNodeImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMProcessingInstruction : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMProcessingInstruction, &IID_IXMLDOMProcessingInstruction> -{ -public: - CXMLDOMProcessingInstruction() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return processingInstruction;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_PROCESSING_INSTRUCTION; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMProcessingInstruction) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMProcessingInstruction) - COM_INTERFACE_ENTRY(IXMLDOMProcessingInstruction) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - // IXMLDOMProcessingInstruction methods - STDMETHOD(get_target)(BSTR *pVal); - STDMETHOD(get_data)(BSTR *pVal); - STDMETHOD(put_data)(BSTR newVal); - - DOMProcessingInstruction* processingInstruction; -}; - -typedef CComObject<CXMLDOMProcessingInstruction> CXMLDOMProcessingInstructionObj; - -#endif // ___xmldomprocessinginstruction_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMText.h b/src/xercesc/com/XMLDOMText.h deleted file mode 100644 index ec7f09595..000000000 --- a/src/xercesc/com/XMLDOMText.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmldomtext_h___ -#define ___xmldomtext_h___ - -#include <xercesc/dom/DOMText.hpp> -#include "IXMLDOMTextImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMText : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMTextImpl<IXMLDOMText, &IID_IXMLDOMText> -{ -public: - CXMLDOMText() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMText* get_DOMText() { return text;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_TEXT; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMText) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMText) - COM_INTERFACE_ENTRY(IXMLDOMText) - COM_INTERFACE_ENTRY(IXMLDOMCharacterData) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - DOMText* text; -}; - -typedef CComObject<CXMLDOMText> CXMLDOMTextObj; - -#endif // ___xmldomtext_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMUtil.cpp b/src/xercesc/com/XMLDOMUtil.cpp deleted file mode 100644 index ae4b46ec7..000000000 --- a/src/xercesc/com/XMLDOMUtil.cpp +++ /dev/null @@ -1,937 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMElement.h" -#include "XMLDOMAttribute.h" -#include "XMLDOMText.h" -#include "XMLDOMCDATASection.h" -#include "XMLDOMEntityReference.h" -#include "XMLDOMEntity.h" -#include "XMLDOMProcessingInstruction.h" -#include "XMLDOMComment.h" -#include "XMLDOMDocument.h" -#include "XMLDOMDocumentType.h" -#include "XMLDOMDocumentFragment.h" -#include "XMLDOMNotation.h" -#include "XMLDOMUtil.h" -#include <xercesc/util/PlatformUtils.hpp> -#include <xercesc/util/XMLUniDefs.hpp> -#include <xercesc/util/XMLString.hpp> - - -const OLECHAR* g_DomNodeName[] = -{ - OLESTR("invalid"), - OLESTR("element"), - OLESTR("attribute"), - OLESTR("text"), - OLESTR("cdatasection"), - OLESTR("entityreference"), - OLESTR("entity"), - OLESTR("processinginstruction"), - OLESTR("comment"), - OLESTR("document"), - OLESTR("documenttype"), - OLESTR("documentfragment"), - OLESTR("notation") -}; - -const int g_DomNodeNameSize = sizeof(g_DomNodeName) / sizeof(OLECHAR*); - -template <class Base> -class CComObjectPool -{ -public: - CComObjectPool(unsigned long poolSize); - - virtual ~CComObjectPool(); - - HRESULT WINAPI CreateInstance(Base** pp); - - HRESULT Deactivate(Base* obj); - -private: - Base** m_pool; - unsigned long m_size; - unsigned long m_hit; - unsigned long m_attempt; - HRESULT Activate(Base* obj); -}; - - - - -template <class Base> -class CPooledComObject : public Base -{ -public: - typedef Base _BaseClass; - CPooledComObject(void* = NULL) - { - _Module.Lock(); - } - // Set refcount to 1 to protect destruction - ~CPooledComObject() - { - m_dwRef = 1L; - FinalRelease(); -#ifdef _ATL_DEBUG_INTERFACES - _Module.DeleteNonAddRefThunk(_GetRawUnknown()); -#endif - _Module.Unlock(); - } - //If InternalAddRef or InternalRelease is undefined then your class - //doesn't derive from CComObjectRoot - STDMETHOD_(ULONG, AddRef)() {return InternalAddRef();} - STDMETHOD_(ULONG, Release)() - { - ULONG l = InternalRelease(); - if (l == 0) { - if(SUCCEEDED(m_pool.Deactivate(this))) { - FinalRelease(); - } - else - delete this; - } - return l; - } - //if _InternalQueryInterface is undefined then you forgot BEGIN_COM_MAP - STDMETHOD(QueryInterface)(REFIID iid, void ** ppvObject) - {return _InternalQueryInterface(iid, ppvObject);} - template <class Q> - HRESULT STDMETHODCALLTYPE QueryInterface(Q** pp) - { - return QueryInterface(__uuidof(Q), (void**)pp); - } - - static HRESULT WINAPI CreateInstance(Base** pp) { - return m_pool.CreateInstance(pp); - } - -private: - static CComObjectPool<Base> m_pool; -}; - - - - -template <class Base> -CComObjectPool<Base>::CComObjectPool(unsigned long poolSize) { - m_pool = NULL; - m_size = poolSize; - m_pool = new Base*[m_size]; - for(unsigned long i = 0; i < m_size; i++) - m_pool[i] = NULL; - m_hit= 0; - m_attempt = 0; -} - -template <class Base> -CComObjectPool<Base>::~CComObjectPool() { - for(unsigned long i = 0; i < m_size; i++) { - if(m_pool[i]) delete m_pool[i]; - } - delete [] m_pool; -} - -template <class Base> -HRESULT CComObjectPool<Base>::Deactivate(Base* obj) { - for(unsigned long i = 0; i < m_size; i++) { - if(m_pool[i] == NULL) { - m_pool[i] = obj; - return S_OK; - } - } - return E_FAIL; -} - -template <class Base> -HRESULT CComObjectPool<Base>::Activate(Base* p) -{ - p->SetVoid(NULL); - p->InternalFinalConstructAddRef(); - HRESULT hRes = p->FinalConstruct(); - p->InternalFinalConstructRelease(); - return hRes; -} - - -template <class Base> -HRESULT WINAPI CComObjectPool<Base>::CreateInstance(Base** pp) { - ATLASSERT(pp != NULL); - HRESULT hRes = E_OUTOFMEMORY; - Base* p = NULL; - - m_attempt++; - - for(unsigned long i = 0; i < m_size; i++) { - if(m_pool[i]) { - p = m_pool[i]; - m_pool[i] = NULL; - hRes = Activate(p); - if (SUCCEEDED(hRes)) { - m_hit++; - break; - } - else { - delete p; - p = NULL; - } - } - } - - if(FAILED(hRes)) { - ATLTRY(p = new CPooledComObject<Base>()) - if (p != NULL) { - hRes = Activate(p); - if (hRes != S_OK) { - delete p; - p = NULL; - } - } - } - *pp = p; - return hRes; -} - - -CComObjectPool<CXMLDOMElement> CPooledComObject<CXMLDOMElement>::m_pool(6); -typedef CPooledComObject<CXMLDOMElement> CPooledXMLDOMElementObj; - -CComObjectPool<CXMLDOMAttribute> CPooledComObject<CXMLDOMAttribute>::m_pool(6); -typedef CPooledComObject<CXMLDOMAttribute> CPooledXMLDOMAttributeObj; - -CComObjectPool<CXMLDOMText> CPooledComObject<CXMLDOMText>::m_pool(6); -typedef CPooledComObject<CXMLDOMText> CPooledXMLDOMTextObj; - -CComObjectPool<CXMLDOMCDATASection> CPooledComObject<CXMLDOMCDATASection>::m_pool(6); -typedef CPooledComObject<CXMLDOMCDATASection> CPooledXMLDOMCDATASectionObj; - -CComObjectPool<CXMLDOMEntityReference> CPooledComObject<CXMLDOMEntityReference>::m_pool(6); -typedef CPooledComObject<CXMLDOMEntityReference> CPooledXMLDOMEntityReferenceObj; - -CComObjectPool<CXMLDOMEntity> CPooledComObject<CXMLDOMEntity>::m_pool(6); -typedef CPooledComObject<CXMLDOMEntity> CPooledXMLDOMEntityObj; - -CComObjectPool<CXMLDOMProcessingInstruction> CPooledComObject<CXMLDOMProcessingInstruction>::m_pool(6); -typedef CPooledComObject<CXMLDOMProcessingInstruction> CPooledXMLDOMProcessingInstructionObj; - -CComObjectPool<CXMLDOMComment> CPooledComObject<CXMLDOMComment>::m_pool(6); -typedef CPooledComObject<CXMLDOMComment> CPooledXMLDOMCommentObj; - - -HRESULT wrapNode(IXMLDOMDocument *pDoc, DOMNode* node, REFIID iid, LPVOID *pVal) -{ - HRESULT hr = S_OK; - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - short type = node->getNodeType(); - - // the way we are constructing the wrappers is kind of fishy but oh well... - // the various IBM DOM wrapper classes don't ever add any members or have - // any v-tables so what we are doing should be safe. There isn't any other - // way as far as I can tell to do this.... - - switch(type) - { - case DOMNode::ELEMENT_NODE: - { - CXMLDOMElement *pObj = NULL; - hr = CPooledXMLDOMElementObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->element = static_cast<DOMElement*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::ATTRIBUTE_NODE: - { - CXMLDOMAttribute *pObj = NULL; - hr = CPooledXMLDOMAttributeObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->attr = static_cast<DOMAttr*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::TEXT_NODE: - { - CXMLDOMText *pObj = NULL; - hr = CPooledXMLDOMTextObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->text = static_cast<DOMText*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::CDATA_SECTION_NODE: - { - CXMLDOMCDATASection *pObj = NULL; - hr = CPooledXMLDOMCDATASectionObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->cdataSection = static_cast<DOMCDATASection*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::ENTITY_REFERENCE_NODE: - { - CXMLDOMEntityReference *pObj = NULL; - hr = CPooledXMLDOMEntityReferenceObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->entityReference = static_cast<DOMEntityReference*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::ENTITY_NODE: - { - CXMLDOMEntity *pObj = NULL; - hr = CPooledXMLDOMEntityObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->entity = static_cast<DOMEntity*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::PROCESSING_INSTRUCTION_NODE: - { - CXMLDOMProcessingInstruction *pObj = NULL; - hr = CPooledXMLDOMProcessingInstructionObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->processingInstruction = static_cast<DOMProcessingInstruction*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::COMMENT_NODE: - { - CXMLDOMComment *pObj = NULL; - hr = CPooledXMLDOMCommentObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->comment = static_cast<DOMComment*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::DOCUMENT_NODE: - { - CXMLDOMDocumentObj *pObj = NULL; - hr = CXMLDOMDocumentObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->m_Document = static_cast<XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::DOCUMENT_TYPE_NODE: - { - CXMLDOMDocumentTypeObj *pObj = NULL; - hr = CXMLDOMDocumentTypeObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->documentType = static_cast<DOMDocumentType*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::DOCUMENT_FRAGMENT_NODE: - { - CXMLDOMDocumentFragmentObj *pObj = NULL; - hr = CXMLDOMDocumentFragmentObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->documentFragment = static_cast<DOMDocumentFragment*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - case DOMNode::NOTATION_NODE: - { - CXMLDOMNotationObj *pObj = NULL; - hr = CXMLDOMNotationObj::CreateInstance(&pObj); - if (S_OK != hr) - return hr; - - pObj->AddRef(); - pObj->SetOwnerDoc(pDoc); - - try - { - pObj->notation = static_cast<DOMNotation*> (node); - } - catch(DOMException& ex) - { - pObj->Release(); - return MakeHRESULT(ex); - } - catch(...) - { - pObj->Release(); - return E_FAIL; - } - - hr = pObj->QueryInterface(iid, pVal); - if (S_OK != hr) - *pVal = NULL; - - pObj->Release(); - break; - } - - default: - hr = E_NOTIMPL; - break; - } - - return hr; -} - - -class xmlstream { -public: - xmlstream() { - m_length = 0; - m_alloc = 0; - m_buffer = 0; - m_next = 0; - } - - ~xmlstream() { - delete [] m_buffer; - } - - xmlstream& operator<<(const XMLCh* other) { - // - // get length of string - // - unsigned long len = 0; - for(const XMLCh* source = other; *source; source++,len++); - - // - // append to stream - // - append(other,len); - return *this; - } - - xmlstream& operator<<(const XMLCh other) { - append(&other,1); - return *this; - } - - BSTR SysAllocString() { - if(m_length > 0) - return SysAllocStringLen(m_buffer,m_length); - return 0; - } - -private: - void append(const XMLCh* other,unsigned long length) { - const XMLCh* source = NULL; - - if(m_length + length > m_alloc) { - unsigned long chunk = 4096; - if(length > chunk) chunk += length; - XMLCh* newbuf = new XMLCh[m_alloc+ chunk]; - m_alloc += chunk; - m_next = newbuf + m_length; - - // - // copy old content into new buffer - // - XMLCh* dest = newbuf; - source = m_buffer; - for(unsigned long i = 0; i < m_length; i++,dest++,source++) { - *dest = *source; - } - delete [] m_buffer; - m_buffer = newbuf; - } - - source = other; - for(unsigned long i = 0; i < length; i++,source++,m_next++) { - *m_next = *source; - } - m_length += length; - } - - unsigned long m_length; - unsigned long m_alloc; - XMLCh* m_buffer; - XMLCh* m_next; -}; - - - - -// --------------------------------------------------------------------------- -// outputContent -// -// Write document content from a string to a C++ ostream. Escape the -// XML special characters (<, &, etc.) unless this is suppressed by the -// command line option. -// --------------------------------------------------------------------------- -void outputContent(xmlstream& target, const XMLCh* toWrite) -{ - - XMLSize_t length = XMLString::stringLen(toWrite); - - XMLSize_t index; - for (index = 0; index < length; index++) - { - switch (toWrite[index]) - { - case chAmpersand : - target << XMLStrL("&"); - break; - - case chOpenAngle : - target << XMLStrL("<"); - break; - - case chCloseAngle: - target << XMLStrL(">"); - break; - - case chDoubleQuote : - target << XMLStrL("""); - break; - - default: - // If it is none of the special characters, print it as such - target << toWrite[index]; - break; - } - } - - return; -} - -xmlstream& operator<<(xmlstream& target, const DOMNode* toWrite) -{ - // Get the name and value out for convenience - const XMLCh* nodeName = toWrite->getNodeName(); - const XMLCh* nodeValue = toWrite->getNodeValue(); - - - switch (toWrite->getNodeType()) - { - case DOMNode::TEXT_NODE: - { - outputContent(target, nodeValue); - break; - } - - case DOMNode::PROCESSING_INSTRUCTION_NODE : - { - target << XMLStrL("<?") - << nodeName - << XMLStrL(' ') - << nodeValue - << XMLStrL("?>"); - break; - } - - case DOMNode::DOCUMENT_NODE : - { - // - // Bug here: we need to find a way to get the encoding name - // for the default code page on the system where the program - // is running, and plug that in for the encoding name. - // - XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* document=(XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument*)toWrite; - target << XMLStrL("<?xml version=\"") << document->getXmlVersion() << XMLStrL("\""); - const XMLCh* str = document->getXmlEncoding(); - if (str != 0) - target << XMLStrL(" encoding=\"") << str << XMLStrL("\""); - if(document->getXmlStandalone()) - target << XMLStrL(" standalone=\"yes\""); - target << XMLStrL("?>"); - - DOMNode* child = toWrite->getFirstChild(); - while( child != 0) - { - target << child; - child = child->getNextSibling(); - } - break; - } - - case DOMNode::ELEMENT_NODE : - { - // Output the element start tag. - target << XMLStrL('<') << nodeName; - - // Output any attributes on this element - DOMNamedNodeMap* attributes = toWrite->getAttributes(); - unsigned int attrCount = attributes->getLength(); - for (unsigned int i = 0; i < attrCount; i++) - { - DOMNode* attribute = attributes->item(i); - - target << XMLStrL(' ') << attribute->getNodeName() - << XMLStrL(" = \""); - // Note that "<" must be escaped in attribute values. - outputContent(target, attribute->getNodeValue()); - target << XMLStrL('"'); - } - - // - // Test for the presence of children, which includes both - // text content and nested elements. - // - DOMNode* child = toWrite->getFirstChild(); - if (child != 0) - { - // There are children. Close start-tag, and output children. - target << XMLStrL(">"); - while( child != 0) - { - target << child; - child = child->getNextSibling(); - } - - // Done with children. Output the end tag. - target << XMLStrL("</") << nodeName << XMLStrL(">"); - } - else - { - // - // There were no children. Output the short form close of - // the element start tag, making it an empty-element tag. - // - target << XMLStrL("/>"); - } - break; - } - - case DOMNode::ENTITY_REFERENCE_NODE: - { - DOMNode* child; - for (child = toWrite->getFirstChild(); child != 0; child = child->getNextSibling()) - target << child; - break; - } - - case DOMNode::CDATA_SECTION_NODE: - { - target << XMLStrL("<![CDATA[") << nodeValue << XMLStrL("]]>"); - break; - } - - case DOMNode::COMMENT_NODE: - { - target << XMLStrL("<!--") << nodeValue << XMLStrL("-->"); - break; - } - - case DOMNode::DOCUMENT_TYPE_NODE: - { - DOMDocumentType* doctype = (DOMDocumentType*)toWrite;; - - target << XMLStrL("<!DOCTYPE ") << nodeName ; - const XMLCh* id = doctype->getPublicId(); - if (id != 0) - target << XMLStrL(" PUBLIC \"") << id << XMLStrL("\""); - id = doctype->getSystemId(); - if (id != 0) - target << XMLStrL(" SYSTEM \"") << id << XMLStrL("\""); - id = doctype->getInternalSubset(); - if (id !=0) - target << XMLStrL(" [ ") << id << XMLStrL("]"); - target << XMLStrL(">"); - break; - } - case DOMNode::ENTITY_NODE: - { - DOMEntity* entity = (DOMEntity*)toWrite;; - - target << XMLStrL("<!ENTITY ") << nodeName; - const XMLCh* id = entity->getPublicId(); - if (id != 0) - target << XMLStrL("PUBLIC \"") << id << XMLStrL("\""); - id = entity->getSystemId(); - if (id != 0) - target << XMLStrL("SYSTEM \"") << id << XMLStrL("\""); - id = entity->getNotationName(); - if (id != 0) - target << XMLStrL("NDATA \"") << id << XMLStrL("\""); - - break; - } - default: - target << XMLStrL("<!-- Unrecognized node type -->"); - } - return target; -} - -void GetXML(const DOMNode* node, _bstr_t &text) -{ - xmlstream stream; - stream << node; - text = _bstr_t(stream.SysAllocString(),false); -} - diff --git a/src/xercesc/com/XMLDOMUtil.h b/src/xercesc/com/XMLDOMUtil.h deleted file mode 100644 index e5a24ec1a..000000000 --- a/src/xercesc/com/XMLDOMUtil.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___wrapnode_h___ -#define ___wrapnode_h___ - -#include <xercesc/util/XercesDefs.hpp> -#include <xercesc/dom/DOMNode.hpp> -XERCES_CPP_NAMESPACE_USE - -extern const OLECHAR* g_DomNodeName[]; -extern const int g_DomNodeNameSize; - -void GetXML (const DOMNode* node, _bstr_t &text); -HRESULT wrapNode(IXMLDOMDocument *pDoc, DOMNode* node, REFIID iid, LPVOID *pVal); - - - -#endif // ___wrapnode_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLDOMXMLDecl.cpp b/src/xercesc/com/XMLDOMXMLDecl.cpp deleted file mode 100644 index 0adae6222..000000000 --- a/src/xercesc/com/XMLDOMXMLDecl.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/* - * $Id$ - */ - -#include "stdafx.h" -#include "xml4com.h" -#include "XMLDOMXMLDecl.h" - -// IXMLDOMProcessingInstruction methods -STDMETHODIMP CXMLDOMXMLDecl::get_target(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMXMLDecl::get_target\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(OLESTR("xml")); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; -} - -STDMETHODIMP CXMLDOMXMLDecl::get_data(BSTR *pVal) -{ - ATLTRACE(_T("CXMLDOMXMLDecl::get_data\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - try - { - *pVal = SysAllocString(xmlDecl->getTarget()); - } - catch(DOMException& ex) - { - return MakeHRESULT(ex); - } - catch(...) - { - return E_FAIL; - } - - return S_OK; - -} - -STDMETHODIMP CXMLDOMXMLDecl::put_data(BSTR newVal) -{ - ATLTRACE(_T("CXMLDOMXMLDecl::put_data\n")); - - return E_NOTIMPL; -} diff --git a/src/xercesc/com/XMLDOMXMLDecl.h b/src/xercesc/com/XMLDOMXMLDecl.h deleted file mode 100644 index 6d02888fb..000000000 --- a/src/xercesc/com/XMLDOMXMLDecl.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef ___xmldomxmldecl_h___ -#define ___xmldomxmldecl_h___ - -#include <xercesc/dom/DOMProcessingInstruction.hpp> -#include "IXMLDOMNodeImpl.h" - -XERCES_CPP_NAMESPACE_USE - -class ATL_NO_VTABLE CXMLDOMXMLDecl : - public CComObjectRootEx<CComSingleThreadModel>, - public IXMLDOMNodeImpl<IXMLDOMProcessingInstruction, &IID_IXMLDOMProcessingInstruction> -{ -public: - CXMLDOMXMLDecl() - {} - - void FinalRelease() - { - ReleaseOwnerDoc(); - } - - virtual DOMNode* get_DOMNode() { return xmlDecl;} - virtual DOMNodeType get_DOMNodeType() const { return NODE_PROCESSING_INSTRUCTION; } - -DECLARE_NOT_AGGREGATABLE(CXMLDOMXMLDecl) -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLDOMXMLDecl) - COM_INTERFACE_ENTRY(IXMLDOMProcessingInstruction) - COM_INTERFACE_ENTRY(IXMLDOMNode) - COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) - COM_INTERFACE_ENTRY(IDispatch) -END_COM_MAP() - - // IXMLDOMProcessingInstruction methods - STDMETHOD(get_target)(BSTR *pVal); - STDMETHOD(get_data)(BSTR *pVal); - STDMETHOD(put_data)(BSTR newVal); - - DOMProcessingInstruction* xmlDecl; -}; - -typedef CComObject<CXMLDOMXMLDecl> CXMLDOMXMLDeclObj; - -#endif // ___xmldomprocessinginstruction_h___ \ No newline at end of file diff --git a/src/xercesc/com/XMLHTTPRequest.cpp b/src/xercesc/com/XMLHTTPRequest.cpp deleted file mode 100644 index 617a599f5..000000000 --- a/src/xercesc/com/XMLHTTPRequest.cpp +++ /dev/null @@ -1,1096 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#include "stdafx.h" - -#include "xml4com.h" -#include "XMLHttpRequest.h" -#include "XMLDOMDocument.h" - -// I need to make sure the file is registered with long filenames -HRESULT WINAPI CXMLHttpRequest::UpdateRegistry(BOOL bRegister) -{ - USES_CONVERSION; - - TCHAR file[MAX_PATH]; - if (::GetModuleFileName(_Module.m_hInst, file, MAX_PATH)) { - WIN32_FIND_DATA d; - memset(&d,0,sizeof(WIN32_FIND_DATA)); - HANDLE h = FindFirstFile(file,&d); - if (h != INVALID_HANDLE_VALUE) { - TCHAR *name = _tcsrchr(file,_T('\\')); - TCHAR newFile[MAX_PATH] = _T(""); - _tcsncpy(newFile,file,name-file); - _tcscat(newFile,_T("\\")); - _tcscat(newFile,d.cFileName); - FindClose(h); - - _ATL_REGMAP_ENTRY regmap[2] = {{NULL,NULL},{NULL,NULL}}; - regmap[0].szKey = OLESTR("XMLMODULE"); - regmap[0].szData = T2OLE(newFile); - return _Module.UpdateRegistryFromResource((UINT) IDR_XMLHTTPREQUEST, bRegister,regmap); - } - } - return E_FAIL; -} - -CXMLHttpRequest::CXMLHttpRequest() - :m_pOnReadyStateChange (NULL) - ,m_bAbort (false) - ,m_hThread (NULL) - ,m_lReadyState (0) - ,m_bAsync (false) - ,m_Method (_T("")) - ,m_HostName (_T("")) - ,m_Port (INTERNET_DEFAULT_HTTP_PORT) - ,m_URLPath (_T("")) - ,m_User (_T("")) - ,m_Password (_T("")) - ,m_dwStatus (0) - ,m_StatusText (_T("")) - ,m_ResponseHeaders (_T("")) - ,m_HwndParent (NULL) - ,m_pBody (NULL) - ,m_lBodyLength (0) - ,m_pResponseBody (NULL) - ,m_lResponseBodyLength (0) - ,m_Error (_T("")) - ,m_bSuccess (true) -{ -} - -HRESULT CXMLHttpRequest::FinalConstruct() -{ - // create monitor window - RECT rc; - memset(&rc,0,sizeof(RECT)); - if (NULL == Create(NULL, rc, _T("XML HTTP Request Monitor Window"), 0)) - return E_FAIL; - - return S_OK; -} - -void CXMLHttpRequest::FinalRelease() -{ - if (NULL != m_hThread) { - m_bAbort = true; - ::WaitForSingleObject(m_hThread, INFINITE); - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - if (m_pOnReadyStateChange != NULL) { - m_pOnReadyStateChange->Release(); - m_pOnReadyStateChange = NULL; - } - - DestroyWindow(); - - delete [] m_pBody; - m_pBody = NULL; - m_lBodyLength = 0; - - delete [] m_pResponseBody; - m_pResponseBody = NULL; - m_lResponseBodyLength = 0; -} - -LRESULT CXMLHttpRequest::OnReadyStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) -{ - ATLTRACE(_T("CXMLHttpRequest::OnReadyStateChange\n")); - - bHandled = TRUE; - - m_lReadyState = (long)wParam; - if (NULL != m_pOnReadyStateChange) { - CComVariant varResult; - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - m_pOnReadyStateChange->Invoke(DISPID_VALUE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL); - } - - return 1L; -} - - -STDMETHODIMP CXMLHttpRequest::InterfaceSupportsErrorInfo(REFIID riid) -{ - if (IsEqualGUID(IID_IXMLHttpRequest,riid)) - return S_OK; - return S_FALSE; -} - -STDMETHODIMP CXMLHttpRequest::open(BSTR bstrMethod, BSTR bstrUrl,VARIANT varAsync,VARIANT bstrUser,VARIANT bstrPassword) -{ - ATLTRACE(_T("CXMLHttpRequest::open\n")); - - // do not open if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_FAIL; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - if (V_VT(&varAsync) != VT_BOOL) - return E_INVALIDARG; - - _bstr_t method = bstrMethod; - if (0 == method.length()) - return E_INVALIDARG; - - _bstr_t url = bstrUrl; - if (0 == url.length()) - return E_INVALIDARG; - - TCHAR hostName[INTERNET_MAX_PATH_LENGTH] = _T(""); - TCHAR strPathName[INTERNET_MAX_PATH_LENGTH] = _T(""); - URL_COMPONENTS urlComponents; - memset(&urlComponents, 0, sizeof(URL_COMPONENTS)); - urlComponents.dwStructSize = sizeof(URL_COMPONENTS); - urlComponents.lpszHostName = hostName; - urlComponents.dwHostNameLength = INTERNET_MAX_PATH_LENGTH; - urlComponents.lpszUrlPath = strPathName; - urlComponents.dwUrlPathLength = INTERNET_MAX_PATH_LENGTH; - - if (!InternetCrackUrl(url, url.length(), 0, &urlComponents)) - return E_INVALIDARG; - - m_Method = method; - m_HostName = hostName; - if (urlComponents.nPort != 0) - m_Port = urlComponents.nPort; - - m_URLPath = strPathName; - m_bAsync = (VARIANT_TRUE == V_BOOL(&varAsync)) ? true : false; - if (VT_BSTR == V_VT(&bstrUser)) - m_User = V_BSTR(&bstrUser); - else - m_User = _T(""); - - if (VT_BSTR == V_VT(&bstrPassword) && m_User.length() > 0) - m_Password = V_BSTR(&bstrPassword); - else - m_Password = _T(""); - - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::setRequestHeader(BSTR bstrHeader, BSTR bstrValue) -{ - ATLTRACE(_T("CXMLHttpRequest::setRequestHeader\n")); - - if (NULL == bstrHeader || NULL == bstrValue) - return E_INVALIDARG; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - m_RequestHeaderMap.Remove(bstrHeader); - m_RequestHeaderMap.Add(bstrHeader,bstrValue); - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::getResponseHeader(BSTR bstrHeader, BSTR * pbstrValue) -{ - ATLTRACE(_T("CXMLHttpRequest::getResponseHeader\n")); - - if (NULL == pbstrValue) - return E_POINTER; - - *pbstrValue = NULL; - - if (NULL == bstrHeader) - return E_INVALIDARG; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - if (0 == m_ResponseHeaders.length()) - return S_FALSE; - - _bstr_t value; - _bstr_t header(bstrHeader); - header += _T(": "); - _tcslwr(header); - TCHAR *pHeaders = new TCHAR[m_ResponseHeaders.length() + sizeof(TCHAR)]; - _tcscpy(pHeaders,m_ResponseHeaders); - _tcslwr(pHeaders); - TCHAR *pStart = _tcsstr(pHeaders,header); - if (pStart) { - pStart += header.length(); - TCHAR *pEnd = _tcsstr(pStart,_T("\r\n")); - if (pEnd) { - TCHAR *pHeader = new TCHAR[pEnd-pStart + sizeof(TCHAR)]; - _tcsncpy(pHeader,static_cast<LPCTSTR> (m_ResponseHeaders) + (pStart-pHeaders),pEnd-pStart); - value = pHeader; - delete [] pHeader; - } - } - delete[] pHeaders; - - if (0 == value.length()) - return S_FALSE; - - *pbstrValue = value.copy(); - - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::getAllResponseHeaders(BSTR * pbstrHeaders) -{ - ATLTRACE(_T("CXMLHttpRequest::getAllResponseHeaders\n")); - - if (NULL == pbstrHeaders) - return E_POINTER; - - *pbstrHeaders = NULL; - - if (NULL == pbstrHeaders) - return E_INVALIDARG; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - *pbstrHeaders = m_ResponseHeaders.copy(); - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::send(VARIANT varBody) -{ - ATLTRACE(_T("CXMLHttpRequest::send\n")); - - if (V_VT(&varBody) != VT_BSTR && - V_VT(&varBody) != VT_DISPATCH && - V_VT(&varBody) != (VT_ARRAY | VT_VARIANT) && - V_VT(&varBody) != (VT_ARRAY | VT_UI1) && - V_VT(&varBody) != VT_UNKNOWN) - return E_INVALIDARG; - - // do not start another thread if there is another active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - HRESULT hr = S_OK; - m_bSuccess = true; - m_bAbort = false; - delete [] m_pBody; - m_pBody = NULL; - m_lBodyLength = 0; - delete [] m_pResponseBody; - m_pResponseBody = NULL; - m_lResponseBodyLength = 0; - m_dwStatus = 0; - m_StatusText = _T(""); - m_ResponseHeaders = _T(""); - - if (V_VT(&varBody) == VT_BSTR) { - _bstr_t body = V_BSTR(&varBody); - m_lBodyLength = body.length() + 1; - m_pBody = new BYTE[m_lBodyLength]; - memset(m_pBody,0,m_lBodyLength); - memcpy(m_pBody,static_cast<char*> (body),body.length()); - } - else - if (V_VT(&varBody) == VT_UNKNOWN) { - CComQIPtr<IStream,&IID_IStream> pS(V_UNKNOWN(&varBody)); - if (!pS) - return E_INVALIDARG; - - CComBSTR b; - hr = b.ReadFromStream(pS); - if (S_OK != hr) - return hr; - - _bstr_t body = b; - m_lBodyLength = body.length() + 1; - m_pBody = new BYTE[m_lBodyLength]; - memset(m_pBody,0,m_lBodyLength); - memcpy(m_pBody,static_cast<char*> (body),body.length()); - } - else - if (V_VT(&varBody) == VT_DISPATCH) { - CComQIPtr<IXMLDOMDocument,&IID_IXMLDOMDocument> pDoc(V_DISPATCH(&varBody)); - if (!pDoc) - return E_INVALIDARG; - - BSTR b = NULL; - hr = pDoc->get_xml(&b); - if (S_OK != hr) - return hr; - - _bstr_t body = b; - ::SysFreeString(b); - - m_lBodyLength = body.length() + 1; - m_pBody = new BYTE[m_lBodyLength]; - memset(m_pBody,0,m_lBodyLength); - memcpy(m_pBody,static_cast<char*> (body),body.length()); - } - else - if (V_VT(&varBody) == (VT_ARRAY | VT_VARIANT)) { - SAFEARRAY *pArray = reinterpret_cast<SAFEARRAY *> (varBody.byref); - if (NULL == pArray) - return E_INVALIDARG; - - long lLBoundVar = 0; - long lUBoundVar = 0; - - UINT dims = ::SafeArrayGetDim(pArray); - if (dims == 0) - return E_INVALIDARG; - - hr = ::SafeArrayGetLBound(pArray, dims, &lLBoundVar); - if (S_OK != hr) - return hr; - - hr = ::SafeArrayGetUBound(pArray, dims, &lUBoundVar); - if (S_OK != hr) - return hr; - - if (lUBoundVar >= lLBoundVar) { - VARIANT *pIndex = NULL; - hr = ::SafeArrayAccessData(pArray, reinterpret_cast<void **> (&pIndex)); - if (S_OK != hr) - return hr; - - m_lBodyLength = lUBoundVar-lLBoundVar+1; - m_pBody = new BYTE[m_lBodyLength]; - for (long i = 0; i <= lUBoundVar-lLBoundVar; ++i) { - VARIANT var = pIndex[i]; - if (V_VT(&var) != VT_UI1) { - hr = E_INVALIDARG; - break; - } - m_pBody[i] = V_UI1(&var); - } - - ::SafeArrayUnaccessData(pArray); - if (S_OK != hr) { - delete [] m_pBody; - m_pBody = NULL; - m_lBodyLength = 0; - return hr; - } - } - } - else - if (V_VT(&varBody) == (VT_ARRAY | VT_UI1)) { - SAFEARRAY *pArray = reinterpret_cast<SAFEARRAY *> (varBody.byref); - if (NULL == pArray) - return E_INVALIDARG; - - long lLBoundVar = 0; - long lUBoundVar = 0; - - UINT dims = ::SafeArrayGetDim(pArray); - if (dims == 0) - return E_INVALIDARG; - - hr = ::SafeArrayGetLBound(pArray, dims, &lLBoundVar); - if (S_OK != hr) - return hr; - - hr = ::SafeArrayGetUBound(pArray, dims, &lUBoundVar); - if (S_OK != hr) - return hr; - - if (lUBoundVar >= lLBoundVar) { - BYTE *pIndex = NULL; - hr = ::SafeArrayAccessData(pArray, reinterpret_cast<void **> (&pIndex)); - if (S_OK != hr) - return hr; - - m_lBodyLength = lUBoundVar-lLBoundVar+1; - m_pBody = new BYTE[m_lBodyLength]; - for (long i = 0; i <= lUBoundVar-lLBoundVar; ++i) - m_pBody[i] = pIndex[i]; - - ::SafeArrayUnaccessData(pArray); - } - } - - m_HwndParent = GetParentWindow(); - - UINT nthreadID = 0; - m_hThread = reinterpret_cast<HANDLE> (_beginthreadex(NULL, - 0, - CXMLHttpRequest::SendThread, - (void *) this, - 0, - &nthreadID)); - if (NULL == m_hThread) - return E_FAIL; - - if (m_bAsync) - return S_OK; - - bool bWait = true; - while (bWait) { - DWORD dwEvt = MsgWaitForMultipleObjects(1,&m_hThread,FALSE,INFINITE,QS_ALLINPUT); - switch(dwEvt) { - case WAIT_OBJECT_0: - bWait = false; - break; - case WAIT_OBJECT_0 + 1: - { - MSG msg; - while(::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { - if (WM_CLOSE == msg.message || WM_QUIT == msg.message) { - bWait = false; - m_bAbort = true; - break; - } - else { - PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - break; - } - default: - m_bAbort = true; - bWait = false; - break; - } - } - - return S_OK; -} - -UINT APIENTRY CXMLHttpRequest::SendThread(void *pParm) -{ - ATLTRACE(_T("CXMLHttpRequest::SendThread\n")); - - CXMLHttpRequest *pCtx = reinterpret_cast<CXMLHttpRequest *> (pParm); - if (NULL == pCtx) - return 0; - - HINTERNET hOpen = NULL; - HINTERNET hConnect = NULL; - HINTERNET hRequest = NULL; - - hOpen = InternetOpen(_T("XMLHTTP/1.0"),INTERNET_OPEN_TYPE_PRECONFIG, - NULL,NULL,0); - if (NULL == hOpen) { - DWORD res = GetLastError(); - pCtx->m_Error = CXMLHttpRequest::GetErrorMsg(res); - pCtx->m_bSuccess = false; - } - - if (!pCtx->m_bAbort && pCtx->m_bSuccess) { - if (INTERNET_INVALID_STATUS_CALLBACK == InternetSetStatusCallback(hOpen, - CXMLHttpRequest::InternetStatusCallback)) { - pCtx->m_Error = _T("Invalid Internet Status Callback function."); - pCtx->m_bSuccess = false; - } - } - - bool bPromptForAuthentication = true; - if (!pCtx->m_bAbort && pCtx->m_bSuccess) { - LPTSTR lpszUserName = NULL; - LPTSTR lpszPassword = NULL; - if (pCtx->m_User.length() > 0) { - bPromptForAuthentication = false; - lpszUserName = pCtx->m_User; - if (pCtx->m_Password.length() > 0) - lpszPassword = pCtx->m_Password; - } - hConnect = InternetConnect(hOpen,pCtx->m_HostName,pCtx->m_Port,lpszUserName,lpszPassword, - INTERNET_SERVICE_HTTP,0,reinterpret_cast<DWORD> (pCtx)); - if (NULL == hConnect) { - DWORD res = GetLastError(); - pCtx->m_Error = CXMLHttpRequest::GetErrorMsg(res); - pCtx->m_bSuccess = false; - } - } - - if (!pCtx->m_bAbort && pCtx->m_bSuccess) { - DWORD dwFlags = (443 == pCtx->m_Port) ? INTERNET_FLAG_SECURE : 0; - dwFlags |= INTERNET_FLAG_NO_CACHE_WRITE; - hRequest = HttpOpenRequest(hConnect,pCtx->m_Method, - pCtx->m_URLPath,NULL,NULL,NULL, - dwFlags,reinterpret_cast<DWORD> (pCtx)); - if (NULL == hRequest) { - DWORD res = GetLastError(); - pCtx->m_bSuccess = false; - pCtx->m_Error = CXMLHttpRequest::GetErrorMsg(res); - } - } - - BOOL rc = TRUE; - - if (!pCtx->m_bAbort && pCtx->m_bSuccess && pCtx->m_RequestHeaderMap.GetSize() > 0) { - _bstr_t requestHeaders; - for (int i = 0 ; i < pCtx->m_RequestHeaderMap.GetSize(); ++i) { - requestHeaders += pCtx->m_RequestHeaderMap.GetKeyAt(i); - requestHeaders += _T(": "); - requestHeaders += pCtx->m_RequestHeaderMap.GetValueAt(i); - requestHeaders += _T("\r\n"); - } - rc = HttpAddRequestHeaders(hRequest,requestHeaders,-1,HTTP_ADDREQ_FLAG_ADD | HTTP_ADDREQ_FLAG_REPLACE); - if (!rc) { - DWORD res = GetLastError(); - pCtx->m_bSuccess = false; - pCtx->m_Error = CXMLHttpRequest::GetErrorMsg(res); - } - } - - DWORD dwLen = 0; - DWORD dwError = ERROR_SUCCESS; - do { - if (!pCtx->m_bAbort && pCtx->m_bSuccess) { - rc = HttpSendRequest(hRequest,NULL,0,pCtx->m_pBody,pCtx->m_lBodyLength); - if (!rc) { - DWORD res = GetLastError(); - pCtx->m_bSuccess = false; - pCtx->m_Error = CXMLHttpRequest::GetErrorMsg(res); - break; - } - } - if (!pCtx->m_bAbort && pCtx->m_bSuccess) { - dwLen = sizeof(DWORD); - rc = HttpQueryInfo(hRequest, - HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, - &pCtx->m_dwStatus,&dwLen,NULL); - if (!rc) { - DWORD res = GetLastError(); - pCtx->m_bSuccess = false; - pCtx->m_Error = CXMLHttpRequest::GetErrorMsg(res); - break; - } - } - if (!pCtx->m_bAbort && pCtx->m_bSuccess && - bPromptForAuthentication && - (HTTP_STATUS_PROXY_AUTH_REQ == pCtx->m_dwStatus || - HTTP_STATUS_DENIED == pCtx->m_dwStatus)) - dwError = InternetErrorDlg(pCtx->m_HwndParent, - hRequest, - ERROR_INTERNET_INCORRECT_PASSWORD, - FLAGS_ERROR_UI_FILTER_FOR_ERRORS | - FLAGS_ERROR_UI_FLAGS_CHANGE_OPTIONS | - FLAGS_ERROR_UI_FLAGS_GENERATE_DATA, - NULL); - else - break; - - } while (ERROR_INTERNET_FORCE_RETRY == dwError && - !pCtx->m_bAbort && pCtx->m_bSuccess); - - if (!pCtx->m_bAbort && pCtx->m_bSuccess) { - dwLen = 1024; - TCHAR *pBuff = new TCHAR[dwLen]; - rc = HttpQueryInfo(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF,pBuff,&dwLen,NULL); - if (!rc) { - DWORD res = GetLastError(); - if (ERROR_INSUFFICIENT_BUFFER == res) { - delete [] pBuff; - pBuff = new TCHAR[dwLen]; - rc = HttpQueryInfo(hRequest,HTTP_QUERY_RAW_HEADERS_CRLF,pBuff,&dwLen,NULL); - if (!rc) { - res = GetLastError(); - pCtx->m_bSuccess = false; - pCtx->m_Error = CXMLHttpRequest::GetErrorMsg(res); - } - } - else { - pCtx->m_bSuccess = false; - pCtx->m_Error = CXMLHttpRequest::GetErrorMsg(res); - } - } - if (rc) - pCtx->m_ResponseHeaders = pBuff; - - delete [] pBuff; - } - - if (!pCtx->m_bAbort && pCtx->m_bSuccess) { - dwLen = 1024; - TCHAR *pBuff = new TCHAR[dwLen]; - rc = HttpQueryInfo(hRequest,HTTP_QUERY_STATUS_TEXT,pBuff,&dwLen,NULL); - if (!rc) { - DWORD res = GetLastError(); - if (ERROR_INSUFFICIENT_BUFFER == res) { - delete [] pBuff; - pBuff = new TCHAR[dwLen]; - rc = HttpQueryInfo(hRequest,HTTP_QUERY_STATUS_TEXT,pBuff,&dwLen,NULL); - if (!rc) - _tcscpy(pBuff,_T("Unknown")); - } - else - _tcscpy(pBuff,_T("Unknown")); - } - pCtx->m_StatusText = pBuff; - delete [] pBuff; - - if (HTTP_STATUS_OK != pCtx->m_dwStatus) { - TCHAR errBuff[MAX_PATH] = _T(""); - wsprintf(errBuff,_T("HTTP Status Code: %d, Reason: "),pCtx->m_dwStatus); - pCtx->m_Error = errBuff; - pCtx->m_Error += pCtx->m_StatusText; - pCtx->m_bSuccess = false; - } - } - - if (!pCtx->m_bAbort && pCtx->m_bSuccess) { - PBYTE buffer[255]; - DWORD dwRead = 0; - delete [] pCtx->m_pResponseBody; - pCtx->m_pResponseBody = NULL; - pCtx->m_lResponseBodyLength = 0; - while (rc = InternetReadFile(hRequest,buffer,255,&dwRead)) { - if (!rc || pCtx->m_bAbort || 0 == dwRead) - break; - - PBYTE tmp = new BYTE[pCtx->m_lResponseBodyLength + dwRead]; - if (pCtx->m_pResponseBody) { - memcpy(tmp,pCtx->m_pResponseBody,pCtx->m_lResponseBodyLength); - delete [] pCtx->m_pResponseBody; - } - - memcpy(tmp+pCtx->m_lResponseBodyLength,buffer,dwRead); - pCtx->m_pResponseBody = tmp; - pCtx->m_lResponseBodyLength += dwRead; - } - if (!rc) { - DWORD res = GetLastError(); - pCtx->m_Error = _T("Error reading response: ") + CXMLHttpRequest::GetErrorMsg(res); - pCtx->m_bSuccess = false; - } - } - - if (hRequest != NULL) - InternetCloseHandle(hRequest); - - if (hConnect != NULL) - InternetCloseHandle(hConnect); - - if (hOpen) - InternetCloseHandle(hOpen); - - if (!pCtx->m_bAbort && pCtx->m_bAsync) - ::PostMessage(pCtx->m_hWnd,MSG_READY_STATE_CHANGE,4,0); - - return 0; -} - -HWND CXMLHttpRequest::GetParentWindow() -{ - HWND hWnd = GetDesktopWindow(); - - CComPtr<IServiceProvider> pSP; - HRESULT hr = GetSite(IID_IServiceProvider, reinterpret_cast<LPVOID *> (&pSP)); - if (S_OK != hr) - return hWnd; - - CComPtr<IWebBrowser2> pWB; - hr = pSP->QueryService(SID_SWebBrowserApp,IID_IWebBrowser2, - reinterpret_cast<LPVOID *> (&pWB)); - if (S_OK != hr) - return hWnd; - - SHANDLE_PTR lWnd = 0; - hr = pWB->get_HWND(&lWnd); - if (S_OK != hr) - return hWnd; - - return reinterpret_cast<HWND> (lWnd); -} - -void CALLBACK CXMLHttpRequest::InternetStatusCallback(HINTERNET hInternet, - DWORD_PTR dwContext, - DWORD dwInternetStatus, - LPVOID lpvStatusInformation, - DWORD dwStatusInformationLength) -{ - ATLTRACE(_T("CXMLHttpRequest::InternetStatusCallback - dwInternetStatus %d\n"),dwInternetStatus); -} - -STDMETHODIMP CXMLHttpRequest::abort() -{ - ATLTRACE(_T("CXMLHttpRequest::abort\n")); - m_bAbort = true; - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::get_status(long * plStatus) -{ - ATLTRACE(_T("CXMLHttpRequest::get_status\n")); - - if (NULL == plStatus) - return E_POINTER; - - *plStatus = 0; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - *plStatus = m_dwStatus; - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::get_statusText( BSTR * pbstrStatus) -{ - ATLTRACE(_T("CXMLHttpRequest::get_statusText\n")); - - if (NULL == pbstrStatus) - return E_POINTER; - - *pbstrStatus = NULL; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - *pbstrStatus = m_StatusText.copy(); - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::get_responseXML(IDispatch **ppBody) -{ - ATLTRACE(_T("CXMLHttpRequest::get_responseXML\n")); - - if (NULL == ppBody) - return E_POINTER; - - *ppBody = NULL; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - BSTR text = NULL; - HRESULT hr = get_responseText(&text); - if (S_OK != hr || NULL == text) - return hr; - - CXMLDOMDocumentObj *pObj = NULL; - hr = CXMLDOMDocumentObj::CreateInstance(&pObj); - if (S_OK == hr) { - pObj->AddRef(); - VARIANT_BOOL isSuccessful = VARIANT_FALSE; - hr = pObj->loadXML(text, &isSuccessful); - if (S_OK == hr && VARIANT_TRUE == isSuccessful) { - *ppBody = pObj; - (*ppBody)->AddRef(); - } - pObj->Release(); - } - - ::SysFreeString(text); - - return hr; -} - -STDMETHODIMP CXMLHttpRequest::get_responseText(BSTR *pVal) -{ - ATLTRACE(_T("CXMLHttpRequest::get_responseText\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = NULL; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - if (NULL == m_pResponseBody) - return S_OK; - - TCHAR *psz = new TCHAR[m_lResponseBodyLength+1]; - ZeroMemory(psz,m_lResponseBodyLength+1); - CopyMemory(psz,m_pResponseBody,m_lResponseBodyLength); - - *pVal = SysAllocStringByteLen(psz,m_lResponseBodyLength); - delete [] psz; - - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::get_responseBody(VARIANT *pVal) -{ - ATLTRACE(_T("CXMLHttpRequest::get_responseBody\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - V_VT(pVal) = VT_NULL; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - if (NULL == m_pResponseBody) - return S_OK; - - return CXMLHttpRequest::InitializeVarFromByte(*pVal, m_pResponseBody,m_lResponseBodyLength); -} - -STDMETHODIMP CXMLHttpRequest::get_responseStream(VARIANT *pVal) -{ - ATLTRACE(_T("CXMLHttpRequest::get_responseStream\n")); - - if (NULL == pVal) - return E_POINTER; - - ::VariantInit(pVal); - V_VT(pVal) = VT_NULL; - - // check if there is a send active - if (NULL != m_hThread) { - DWORD exitCode = 0; - BOOL rc = ::GetExitCodeThread(m_hThread, &exitCode); - if (!rc || STILL_ACTIVE == exitCode) - return E_PENDING; - - ::CloseHandle(m_hThread); - m_hThread = NULL; - } - - if (NULL == m_pResponseBody) - return S_OK; - - //Create an IStream from global memory - CComPtr<IStream> pStm; - HRESULT hr = CreateStreamOnHGlobal(NULL, TRUE, &pStm); - if (S_OK != hr) - return hr; - - hr = pStm->Write(m_pResponseBody, m_lResponseBodyLength, NULL); - if (S_OK != hr) - return hr; - - LARGE_INTEGER dlibMove; - memset(&dlibMove,0,sizeof(LARGE_INTEGER)); - hr = pStm->Seek(dlibMove,STREAM_SEEK_SET,NULL); - if (S_OK != hr) - return hr; - - V_VT(pVal) = VT_UNKNOWN; - V_UNKNOWN(pVal) = pStm.Detach(); - - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::get_readyState(long *pVal) -{ - ATLTRACE(_T("CXMLHttpRequest::get_readyState\n")); - - if (NULL == pVal) - return E_POINTER; - - *pVal = m_lReadyState; - - return S_OK; -} - -STDMETHODIMP CXMLHttpRequest::put_onreadystatechange(IDispatch * pReadyStateSink) -{ - ATLTRACE(_T("CXMLHttpRequest::put_onreadystatechange\n")); - - if (m_pOnReadyStateChange != NULL) { - m_pOnReadyStateChange->Release(); - m_pOnReadyStateChange = NULL; - } - m_pOnReadyStateChange = pReadyStateSink; - if (m_pOnReadyStateChange != NULL) - m_pOnReadyStateChange->AddRef(); - - return S_OK; -} - -_bstr_t CXMLHttpRequest::GetErrorMsg(DWORD rc) -{ - _bstr_t msg(_T("")); - TCHAR *lpBuffer = NULL; - - if (ERROR_INTERNET_EXTENDED_ERROR == rc) { - DWORD dwError = 0; - DWORD dwLength = 0; - InternetGetLastResponseInfo (&dwError, NULL, &dwLength); - if (dwLength > 0) { - lpBuffer = (TCHAR *) LocalAlloc(LPTR,dwLength); - if (!lpBuffer) { - msg = _T("Unable to allocate memory to display Internet extended error: "); - rc = GetLastError(); - } - else { - if (!InternetGetLastResponseInfo(&dwError,lpBuffer,&dwLength)) { - msg = _T("Unable to get Internet extended error: "); - rc = GetLastError(); - LocalFree(lpBuffer); - } - else { - int len = lstrlen(lpBuffer); - for (int i=0; i < len; ++i) { - if (_istcntrl(lpBuffer[i])) - lpBuffer[i] = _T(' '); - } - msg = lpBuffer; - LocalFree(lpBuffer); - return msg; - } - } - } - } - - lpBuffer = NULL; - HMODULE hModule = NULL; // default to system source - - if (rc >= INTERNET_ERROR_BASE) - hModule = LoadLibraryEx(_T("wininet.dll"),NULL,LOAD_LIBRARY_AS_DATAFILE); - - ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_IGNORE_INSERTS | - FORMAT_MESSAGE_FROM_SYSTEM | - ((hModule != NULL) ? FORMAT_MESSAGE_FROM_HMODULE : 0), - hModule, - rc, - MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT), - (LPTSTR)&lpBuffer, 0, NULL); - - if (lpBuffer) { - int len = lstrlen(lpBuffer); - for (int i=0; i < len; ++i) { - if (_istcntrl(lpBuffer[i])) - lpBuffer[i] = _T(' '); - } - } - - msg += lpBuffer; - LocalFree(lpBuffer); - - if (hModule != NULL) - FreeLibrary(hModule); - - return msg; -} - -HRESULT CXMLHttpRequest::InitializeVarFromByte(VARIANT &varOut, const PBYTE pByte, long lSize) -{ - ::VariantInit(&varOut); - V_VT(&varOut) = VT_NULL; - - HRESULT hr = S_OK; - SAFEARRAYBOUND rgsabound[1]; - rgsabound[0].cElements = lSize; - rgsabound[0].lLbound = 0; - - SAFEARRAY *psa = ::SafeArrayCreate( VT_VARIANT, 1, rgsabound); - if (psa == NULL) - return E_FAIL; - - if (pByte != NULL) { - long ix[1]; - for (ULONG i = 0; i < rgsabound[0].cElements; ++i) { - ix[0] = i; - VARIANT var; - ::VariantInit(&var); - V_VT(&var) = VT_UI1; - V_UI1(&var) = pByte[i]; - - hr = ::SafeArrayPutElement(psa, ix, &var); - if (S_OK != hr) { - ::SafeArrayDestroy(psa); - break; - } - } - } - - if (S_OK == hr) { - V_VT(&varOut) = VT_ARRAY | VT_VARIANT; - V_ARRAY(&varOut) = psa; - } - - return hr; -} \ No newline at end of file diff --git a/src/xercesc/com/XMLHttpRequest.h b/src/xercesc/com/XMLHttpRequest.h deleted file mode 100644 index abee94906..000000000 --- a/src/xercesc/com/XMLHttpRequest.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef ___xmlhttprequest_h___ -#define ___xmlhttprequest_h___ - -#include <xercesc/dom/DOMDocument.hpp> -#include "IXMLDOMNodeImpl.h" - -#include "resource.h" // main symbols - -class ATL_NO_VTABLE CXMLHttpRequest : - public CComObjectRootEx<CComSingleThreadModel>, - public CComCoClass<CXMLHttpRequest, &CLSID_XMLHTTPRequest>, - public IObjectSafetyImpl<CXMLHttpRequest, INTERFACESAFE_FOR_UNTRUSTED_CALLER>, - public IDispatchImpl<IXMLHttpRequest, &IID_IXMLHttpRequest, &LIBID_Xerces, XERCES_VERSION_MAJOR, INVK_CAT2_RAW_NUMERIC(XERCES_VERSION_MINOR,XERCES_VERSION_REVISION)>, - public IObjectWithSiteImpl<CXMLHttpRequest>, - public ISupportErrorInfo, - public CWindowImpl<CXMLHttpRequest, CWindow, CWinTraits<0,0> > -{ -public: - CXMLHttpRequest(); - - HRESULT FinalConstruct(); - void FinalRelease(); - - //DECLARE_REGISTRY_RESOURCEID(IDR_XMLHTTPREQUEST) - static HRESULT WINAPI UpdateRegistry(BOOL bRegister); - -DECLARE_NOT_AGGREGATABLE(CXMLHttpRequest) - -DECLARE_PROTECT_FINAL_CONSTRUCT() - -BEGIN_COM_MAP(CXMLHttpRequest) - COM_INTERFACE_ENTRY(IXMLHttpRequest) - COM_INTERFACE_ENTRY(IDispatch) - COM_INTERFACE_ENTRY(IObjectSafety) - COM_INTERFACE_ENTRY(IObjectWithSite) - COM_INTERFACE_ENTRY(ISupportErrorInfo) -END_COM_MAP() - - DECLARE_WND_CLASS(_T("XMLHttpRequestMonitor")) - -BEGIN_MSG_MAP(CMonitorWnd) - MESSAGE_HANDLER(MSG_READY_STATE_CHANGE, OnReadyStateChange) -END_MSG_MAP() - - LRESULT OnReadyStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); - - - // ISupportsErrorInfo - STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); - - // IXMLHttpRequest methods - STDMETHOD(open)(/*[in]*/ BSTR bstrMethod, /*[in]*/ BSTR bstrUrl, /*[in,optional]*/ VARIANT varAsync, /*[in,optional]*/ VARIANT bstrUser, /*[in,optional]*/ VARIANT bstrPassword); - STDMETHOD(setRequestHeader)(/*[in]*/ BSTR bstrHeader, /*[in]*/ BSTR bstrValue); - STDMETHOD(getResponseHeader)(/*[in]*/ BSTR bstrHeader, /*[out, retval]*/ BSTR * pbstrValue); - STDMETHOD(getAllResponseHeaders)(/*[out, retval]*/ BSTR * pbstrHeaders); - STDMETHOD(send)(/*[in, optional]*/ VARIANT varBody); - STDMETHOD(abort)(); - STDMETHOD(get_status)(/*[out, retval]*/ long * plStatus); - STDMETHOD(get_statusText)(/*[out, retval]*/ BSTR * pbstrStatus); - STDMETHOD(get_responseXML)(/*[out, retval]*/ IDispatch ** ppBody); - STDMETHOD(get_responseText)(/*[out, retval]*/ BSTR * pbstrBody); - STDMETHOD(get_responseBody)(/*[out, retval]*/ VARIANT * pvarBody); - STDMETHOD(get_responseStream)(/*[out, retval]*/ VARIANT * pvarBody); - STDMETHOD(get_readyState)(/*[out, retval]*/ long * plState); - STDMETHOD(put_onreadystatechange)(/*[in]*/ IDispatch * pReadyStateSink); - -private: - - LPDISPATCH m_pOnReadyStateChange; - bool m_bAbort; - HANDLE m_hThread; - long m_lReadyState; - bool m_bAsync; - _bstr_t m_Method; - _bstr_t m_HostName; - INTERNET_PORT m_Port; - _bstr_t m_URLPath; - _bstr_t m_User; - _bstr_t m_Password; - DWORD m_dwStatus; - _bstr_t m_StatusText; - _bstr_t m_ResponseHeaders; - CSimpleMap<_bstr_t, _bstr_t> m_RequestHeaderMap; - HWND m_HwndParent; - - PBYTE m_pBody; - long m_lBodyLength; - PBYTE m_pResponseBody; - long m_lResponseBodyLength; - _bstr_t m_Error; - bool m_bSuccess; - - HWND GetParentWindow(); - - static _bstr_t GetErrorMsg(DWORD rc); - static void CALLBACK InternetStatusCallback(HINTERNET hInternet, - DWORD_PTR dwContext, - DWORD dwInternetStatus, - LPVOID lpvStatusInformation, - DWORD dwStatusInformationLength); - static UINT APIENTRY SendThread(void *pParm); - static HRESULT InitializeVarFromByte(VARIANT &varOut, const PBYTE pByte, long lSize); -}; - -typedef CComObject<CXMLHttpRequest> CXMLHttpRequestObj; - -#endif // ___xmlhttprequest_h___ \ No newline at end of file diff --git a/src/xercesc/com/registry.bin b/src/xercesc/com/registry.bin deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/xercesc/com/resource.h b/src/xercesc/com/resource.h deleted file mode 100644 index 3f7f4bd59..000000000 --- a/src/xercesc/com/resource.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by xml4com.rc -// -#define IDS_PROJNAME 100 -#define IDR_XMLDOCUMENT 203 -#define IDR_XMLHTTPREQUEST 204 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 205 -#define _APS_NEXT_COMMAND_VALUE 32768 -#define _APS_NEXT_CONTROL_VALUE 201 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/src/xercesc/com/xml4com.cpp b/src/xercesc/com/xml4com.cpp deleted file mode 100644 index 329d4915b..000000000 --- a/src/xercesc/com/xml4com.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -// xml4com.cpp : Implementation of DLL Exports. -// Note: Proxy/Stub Information -// To merge the proxy/stub code into the object DLL, add the file -// dlldatax.c to the project. Make sure precompiled headers -// are turned off for this file, and add _MERGE_PROXYSTUB to the -// defines for the project. -// -// If you are not running WinNT4.0 or Win95 with DCOM, then you -// need to remove the following define from dlldatax.c -// #define _WIN32_WINNT 0x0400 -// -// Further, if you are running MIDL without /Oicf switch, you also -// need to remove the following define from dlldatax.c. -// #define USE_STUBLESS_PROXY -// -// Modify the custom build rule for xml4com.idl by adding the following -// files to the Outputs. -// xml4com_p.c -// dlldata.c -// To build a separate proxy/stub DLL, -// run nmake -f xml4comps.mk in the project directory. - -#include "stdafx.h" -#include "resource.h" -#include <initguid.h> - -#include <xercesc/util/PlatformUtils.hpp> -#include "xml4com.h" -#include <xercesc/dom/DOMException.hpp> - -// -// -// These were extracted from an identifier definition file -// generated by compiling MSXML.IDL using the MIDL compiler -// (and removing CLSID_DOMDocument, CLSID_XMLHttpRequest, et al) -// -const IID IID_IXMLDOMImplementation = {0x2933BF8F,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMNode = {0x2933BF80,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMDocumentFragment = {0x3efaa413,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}}; - - -const IID IID_IXMLDOMDocument = {0x2933BF81,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMNodeList = {0x2933BF82,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMNamedNodeMap = {0x2933BF83,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMCharacterData = {0x2933BF84,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMAttribute = {0x2933BF85,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMElement = {0x2933BF86,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMText = {0x2933BF87,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMComment = {0x2933BF88,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMProcessingInstruction = {0x2933BF89,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMCDATASection = {0x2933BF8A,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMDocumentType = {0x2933BF8B,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMNotation = {0x2933BF8C,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMEntity = {0x2933BF8D,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMEntityReference = {0x2933BF8E,0x7B36,0x11d2,{0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60}}; - - -const IID IID_IXMLDOMParseError = {0x3efaa426,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}}; - - -const IID IID_IXTLRuntime = {0x3efaa425,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}}; - - -const IID DIID_XMLDOMDocumentEvents = {0x3efaa427,0x272f,0x11d2,{0x83,0x6f,0x00,0x00,0xf8,0x7a,0x77,0x82}}; - - - -const IID IID_IXMLHttpRequest = {0xED8C108D,0x4349,0x11D2,{0x91,0xA4,0x00,0xC0,0x4F,0x79,0x69,0xE8}}; - - -const IID IID_IXMLDSOControl = {0x310afa62,0x0575,0x11d2,{0x9c,0xa9,0x00,0x60,0xb0,0xec,0x3d,0x39}}; - - -const IID IID_IXMLElementCollection = {0x65725580,0x9B5D,0x11d0,{0x9B,0xFE,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}}; - - -const IID IID_IXMLDocument = {0xF52E2B61,0x18A1,0x11d1,{0xB1,0x05,0x00,0x80,0x5F,0x49,0x91,0x6B}}; - - -const IID IID_IXMLDocument2 = {0x2B8DE2FE,0x8D2D,0x11d1,{0xB2,0xFC,0x00,0xC0,0x4F,0xD9,0x15,0xA9}}; - - -const IID IID_IXMLElement = {0x3F7F31AC,0xE15F,0x11d0,{0x9C,0x25,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}}; - - -const IID IID_IXMLElement2 = {0x2B8DE2FF,0x8D2D,0x11d1,{0xB2,0xFC,0x00,0xC0,0x4F,0xD9,0x15,0xA9}}; - - -const IID IID_IXMLAttribute = {0xD4D4A0FC,0x3B73,0x11d1,{0xB2,0xB4,0x00,0xC0,0x4F,0xB9,0x25,0x96}}; - - -const IID IID_IXMLError = {0x948C5AD3,0xC58D,0x11d0,{0x9C,0x0B,0x00,0xC0,0x4F,0xC9,0x9C,0x8E}}; - - - -// -// This file is generated from the type library compilation -// of xml4com.idl -// -#include "xml4com_i.c" -#include "XMLDOMDocument.h" -#include "XMLHTTPRequest.h" - -#ifdef _MERGE_PROXYSTUB -extern "C" HINSTANCE hProxyDll; -#endif - -CComModule _Module; - -BEGIN_OBJECT_MAP(ObjectMap) -OBJECT_ENTRY(CLSID_DOMDocument, CXMLDOMDocument) -OBJECT_ENTRY(CLSID_XMLHTTPRequest, CXMLHttpRequest) -END_OBJECT_MAP() - -///////////////////////////////////////////////////////////////////////////// -// DLL Entry Point - -extern "C" -BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved) -{ - lpReserved; -#ifdef _MERGE_PROXYSTUB - if (!PrxDllMain(hInstance, dwReason, lpReserved)) - return FALSE; -#endif - if (dwReason == DLL_PROCESS_ATTACH) - { - _Module.Init(ObjectMap, hInstance, &LIBID_Xerces); - DisableThreadLibraryCalls(hInstance); - XMLPlatformUtils::Initialize(); - } - else if (dwReason == DLL_PROCESS_DETACH) - { - XMLPlatformUtils::Terminate(); - _Module.Term(); - } - return TRUE; // ok -} - -///////////////////////////////////////////////////////////////////////////// -// Used to determine whether the DLL can be unloaded by OLE - -STDAPI DllCanUnloadNow(void) -{ -#ifdef _MERGE_PROXYSTUB - if (PrxDllCanUnloadNow() != S_OK) - return S_FALSE; -#endif - return (_Module.GetLockCount()==0) ? S_OK : S_FALSE; -} - -///////////////////////////////////////////////////////////////////////////// -// Returns a class factory to create an object of the requested type - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) -{ -#ifdef _MERGE_PROXYSTUB - if (PrxDllGetClassObject(rclsid, riid, ppv) == S_OK) - return S_OK; -#endif - return _Module.GetClassObject(rclsid, riid, ppv); -} - -///////////////////////////////////////////////////////////////////////////// -// DllRegisterServer - Adds entries to the system registry - -STDAPI DllRegisterServer(void) -{ -#ifdef _MERGE_PROXYSTUB - HRESULT hRes = PrxDllRegisterServer(); - if (FAILED(hRes)) - return hRes; -#endif - // registers object, typelib and all interfaces in typelib - return _Module.RegisterServer(TRUE); -} - -///////////////////////////////////////////////////////////////////////////// -// DllUnregisterServer - Removes entries from the system registry - -STDAPI DllUnregisterServer(void) -{ -#ifdef _MERGE_PROXYSTUB - PrxDllUnregisterServer(); -#endif - return _Module.UnregisterServer(TRUE); -} - - -static LPOLESTR Msgs[] = -{ - OLESTR("UNDEFINED DOM ERROR"), - OLESTR("INDEX_SIZE_ERR"), // INDEX_SIZE_ERR = 1 - OLESTR("DOMSTRING_SIZE_ERR"), // DOMSTRING_SIZE_ERR = 2 - OLESTR("HIERARCHY_REQUEST_ERR"), // HIERARCHY_REQUEST_ERR = 3 - OLESTR("WRONG_DOCUMENT_ERR"), // WRONG_DOCUMENT_ERR = 4 - OLESTR("INVALID_CHARACTER_ERR"), // INVALID_CHARACTER_ERR = 5 - OLESTR("NO_DATA_ALLOWED_ERR"), // NO_DATA_ALLOWED_ERR = 6 - OLESTR("NO_MODIFICATION_ALLOWED_ERR"), // NO_MODIFICATION_ALLOWED_ERR = 7 - OLESTR("NOT_FOUND_ERR"), // NOT_FOUND_ERR = 8 - OLESTR("NOT_SUPPORTED_ERR"), // NOT_SUPPORTED_ERR = 9 - OLESTR("INUSE_ATTRIBUTE_ERR"), // INUSE_ATTRIBUTE_ERR = 10 - OLESTR("INVALID_STATE_ERR"), // INVALID_STATE_ERR = 11 - OLESTR("SYNTAX_ERR "), // SYNTAX_ERR = 12 - OLESTR("INVALID_MODIFICATION_ERR"), // INVALID_MODIFICATION_ERR = 13 - OLESTR("NAMESPACE_ERR"), // NAMESPACE_ERR = 14 - OLESTR("INVALID_ACCESS_ERR") // INVALID_ACCESS_ERR = 15 - OLESTR("VALIDATION_ERR") // VALIDATION_ERR = 16 -}; - -// -// -// makes an HRESULT with a code based on the DOM error code -// -HRESULT MakeHRESULT(DOMException& ex) -{ - ICreateErrorInfo* pCErr = NULL; - HRESULT sc = CreateErrorInfo(&pCErr); - if(SUCCEEDED(sc)) { - const XMLCh* msg = ex.msg; - if(msg == NULL) - { - if(ex.code >= DOMException::INDEX_SIZE_ERR && - ex.code <= DOMException::VALIDATION_ERR) - { - sc = pCErr->SetDescription(Msgs[ex.code]); - } - else - { - sc = pCErr->SetDescription(Msgs[0]); - } - } - else - { - sc = pCErr->SetDescription(SysAllocString(ex.msg)); - } - - IErrorInfo* pErr = NULL; - sc = pCErr->QueryInterface(IID_IErrorInfo,(void**) &pErr); - if(SUCCEEDED(sc)) - { - sc = SetErrorInfo(0,pErr); - pErr->Release(); - } - pCErr->Release(); - } - return 0x80040600 + ex.code; -} - - - diff --git a/src/xercesc/com/xml4com.def b/src/xercesc/com/xml4com.def deleted file mode 100644 index 7090dec24..000000000 --- a/src/xercesc/com/xml4com.def +++ /dev/null @@ -1,9 +0,0 @@ -; xml4com.def : Declares the module parameters. - -LIBRARY "xerces-com.dll" - -EXPORTS - DllCanUnloadNow @1 PRIVATE - DllGetClassObject @2 PRIVATE - DllRegisterServer @3 PRIVATE - DllUnregisterServer @4 PRIVATE diff --git a/src/xercesc/com/xml4com.idl b/src/xercesc/com/xml4com.idl deleted file mode 100644 index 0a3c67006..000000000 --- a/src/xercesc/com/xml4com.idl +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -// This file will be processed by the MIDL tool to -// produce the type library (xml4com.tlb) and marshalling code. - -import "oaidl.idl"; - -[ - uuid(C4775B62-ECD6-11d4-94B4-00A0CC57CBCB), - // - // Format for version is major.minor - // no support for additional parts (like 1.5.2) - // Use 1.60 for subsequent release - version(3.00), - helpstring("Xerces XML Parser 3.0.0") -] -library Xerces -{ - importlib("stdole32.tlb"); - importlib("stdole2.tlb"); - - // - // it appears to be necessary to forward declare - // this interface to lure it into the type library - interface IXMLDOMNotation; - - // - // might as well insure the rest we use are here - // - interface IXMLDOMAttribute; - interface IXMLDOMCDATASection; - interface IXMLDOMComment; - interface IXMLDOMDocument; - interface IXMLDOMDocumentType; - interface IXMLDOMElement; - interface IXMLDOMEntity; - interface IXMLDOMEntityReference; - interface IXMLDOMImplementation; - interface IXMLDOMNamedNodeMap; - interface IXMLDOMNodeList; - interface IXMLDOMParseError; - interface IXMLDOMProcessingInstruction; - interface IXMLDOMText; - interface IXMLHttpRequest; - - - // - // - // if you get an "Cannot open input file" error here - // then you most probably do not have a recent - // Microsoft Platform SDK in your include path - // - // See http://xerces.apache.org/xerces-c/build.html#BuildCOM - import "xmldom.idl"; - - [ - object, - uuid(35ADBB42-47B2-4b22-9D2E-1DA260EE5007), - hidden, - oleautomation, - helpstring("IIBMXMLDOMNodeIdentity Interface"), - pointer_default(unique) - ] - interface IIBMXMLDOMNodeIdentity : IUnknown - { - [propget, helpstring("property NodeId")] HRESULT NodeId([out, retval] long *pVal); - }; - - [ - uuid(C4775B61-ECD6-11d4-94B4-00A0CC57CBCB), - helpstring("DOMDocument Class") - ] - coclass DOMDocument - { - [default] interface IXMLDOMDocument; - [default, source] dispinterface XMLDOMDocumentEvents; - }; - - [ - uuid(3A725053-15FB-4065-9171-BC02BCF3876C), - helpstring("XMLHTTPRequest class.") - ] - coclass XMLHTTPRequest - { - [default] interface IXMLHttpRequest; - }; -}; diff --git a/src/xercesc/com/xml4com.rc b/src/xercesc/com/xml4com.rc deleted file mode 100644 index 06ac83e24..000000000 --- a/src/xercesc/com/xml4com.rc +++ /dev/null @@ -1,121 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "1 TYPELIB ""..\\\\..\\\\..\\\\Build\\\\Win32\\\\xml4com\\\\xml4com.tlb""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,0,0,0 - PRODUCTVERSION 3,0,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Apache Software Foundation" - VALUE "FileDescription", "Xerces XML Parser for COM" - VALUE "FileVersion", "3, 0, 0, 0" - VALUE "InternalName", "Xerces XML Parser for COM " - VALUE "LegalCopyright", "Copyright © Apache Software Foundation 2000 subject to licensing terms" - VALUE "OriginalFilename", "xerces-com.dll" - VALUE "ProductName", "Xerces XML Parser for COM" - VALUE "ProductVersion", "3, 0, 0, 0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// REGISTRY -// - -IDR_XMLDOCUMENT REGISTRY "xmldocument.rgs" -IDR_XMLHTTPREQUEST REGISTRY "xmlhttprequest.rgs" - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE -BEGIN - IDS_PROJNAME "xml4com" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -1 TYPELIB "..\\..\\..\\Build\\Win32\\xml4com\\xml4com.tlb" - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/src/xercesc/com/xml4comCP.h b/src/xercesc/com/xml4comCP.h deleted file mode 100644 index abec411f7..000000000 --- a/src/xercesc/com/xml4comCP.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * $Id$ - */ - -#ifndef _XML4COMCP_H_ -#define _XML4COMCP_H_ - -template <class T> -class CProxyXMLDOMDocumentEvents : public IConnectionPointImpl<T, &DIID_XMLDOMDocumentEvents, CComDynamicUnkArray> -{ - //Warning this class may be recreated by the wizard. -public: - HRESULT Fire_ondataavailable() - { - CComVariant varResult; - T* pT = static_cast<T*>(this); - int nConnectionIndex; - int nConnections = m_vec.GetSize(); - - for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) - { - pT->Lock(); - CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex); - pT->Unlock(); - IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p); - if (pDispatch != NULL) - { - VariantClear(&varResult); - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - pDispatch->Invoke(0xc6, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL); - } - } - return varResult.scode; - - } - HRESULT Fire_onreadystatechange() - { - CComVariant varResult; - T* pT = static_cast<T*>(this); - int nConnectionIndex; - int nConnections = m_vec.GetSize(); - - for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) - { - pT->Lock(); - CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex); - pT->Unlock(); - IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p); - if (pDispatch != NULL) - { - VariantClear(&varResult); - DISPPARAMS disp = { NULL, NULL, 0, 0 }; - pDispatch->Invoke(DISPID_READYSTATECHANGE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL); - } - } - return varResult.scode; - - } -}; -#endif \ No newline at end of file diff --git a/src/xercesc/com/xml4comps.def b/src/xercesc/com/xml4comps.def deleted file mode 100644 index d8319ed42..000000000 --- a/src/xercesc/com/xml4comps.def +++ /dev/null @@ -1,11 +0,0 @@ - -LIBRARY "xml4comPS" - -DESCRIPTION 'Proxy/Stub DLL' - -EXPORTS - DllGetClassObject @1 PRIVATE - DllCanUnloadNow @2 PRIVATE - GetProxyDllInfo @3 PRIVATE - DllRegisterServer @4 PRIVATE - DllUnregisterServer @5 PRIVATE diff --git a/src/xercesc/com/xml4comps.mk b/src/xercesc/com/xml4comps.mk deleted file mode 100644 index 54ad5e406..000000000 --- a/src/xercesc/com/xml4comps.mk +++ /dev/null @@ -1,16 +0,0 @@ - -xml4comps.dll: dlldata.obj xml4com_p.obj xml4com_i.obj - link /dll /out:xml4comps.dll /def:xml4comps.def /entry:DllMain dlldata.obj xml4com_p.obj xml4com_i.obj \ - kernel32.lib rpcndr.lib rpcns4.lib rpcrt4.lib oleaut32.lib uuid.lib \ - -.c.obj: - cl /c /Ox /DWIN32 /D_WIN32_WINNT=0x0400 /DREGISTER_PROXY_DLL \ - $< - -clean: - @del xml4comps.dll - @del xml4comps.lib - @del xml4comps.exp - @del dlldata.obj - @del xml4com_p.obj - @del xml4com_i.obj diff --git a/src/xercesc/com/xmldocument.rgs b/src/xercesc/com/xmldocument.rgs deleted file mode 100644 index 605004f55..000000000 --- a/src/xercesc/com/xmldocument.rgs +++ /dev/null @@ -1,26 +0,0 @@ -HKCR -{ - Xerces.DOMDocument.3.0.0 = s 'Apache Xerces Parser for COM' - { - CLSID = s '{C4775B61-ECD6-11d4-94B4-00A0CC57CBCB}' - } - Xerces.DOMDocument = s 'Apache Xerces Parser For COM' - { - CLSID = s '{C4775B61-ECD6-11d4-94B4-00A0CC57CBCB}' - CurVer = s 'Xerces.DOMDocument.3.0.0' - } - NoRemove CLSID - { - ForceRemove {C4775B61-ECD6-11d4-94B4-00A0CC57CBCB} = s 'Apache Xerces Parser for COM' - { - ProgID = s 'Xerces.DOMDocument.3.0.0' - VersionIndependentProgID = s 'Xerces.DOMDocument' - ForceRemove 'Programmable' - InprocServer32 = s '%XMLMODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{C4775B62-ECD6-11d4-94B4-00A0CC57CBCB}' - } - } -} \ No newline at end of file diff --git a/src/xercesc/com/xmlhttprequest.rgs b/src/xercesc/com/xmlhttprequest.rgs deleted file mode 100644 index 0406b8baf..000000000 --- a/src/xercesc/com/xmlhttprequest.rgs +++ /dev/null @@ -1,26 +0,0 @@ -HKCR -{ - IBMXML.XMLHttpRequest.3.0.0 = s 'Apache Xerces XML Http Request' - { - CLSID = s '{3A725053-15FB-4065-9171-BC02BCF3876C}' - } - IBMXML.XMLHttpRequest = s 'Apache Xerces XML Http Request' - { - CLSID = s '{3A725053-15FB-4065-9171-BC02BCF3876C}' - CurVer = s 'Xerces.XMLHttpRequest.3.0.0' - } - NoRemove CLSID - { - ForceRemove {3A725053-15FB-4065-9171-BC02BCF3876C} = s 'Apache Xerces XML Http Request' - { - ProgID = s 'Xerces.XMLHttpRequest.3.0.0' - VersionIndependentProgID = s 'Xerces.XMLHttpRequest' - ForceRemove 'Programmable' - InprocServer32 = s '%XMLMODULE%' - { - val ThreadingModel = s 'Apartment' - } - 'TypeLib' = s '{C4775B62-ECD6-11d4-94B4-00A0CC57CBCB}' - } - } -} \ No newline at end of file -- GitLab