[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
|
---|
| 5 | * reserved.
|
---|
| 6 | *
|
---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
---|
| 8 | * modification, are permitted provided that the following conditions
|
---|
| 9 | * are met:
|
---|
| 10 | *
|
---|
| 11 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
---|
| 13 | *
|
---|
| 14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer in
|
---|
| 16 | * the documentation and/or other materials provided with the
|
---|
| 17 | * distribution.
|
---|
| 18 | *
|
---|
| 19 | * 3. The end-user documentation included with the redistribution,
|
---|
| 20 | * if any, must include the following acknowledgment:
|
---|
| 21 | * "This product includes software developed by the
|
---|
| 22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 25 | *
|
---|
| 26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 27 | * not be used to endorse or promote products derived from this
|
---|
| 28 | * software without prior written permission. For written
|
---|
| 29 | * permission, please contact apache\@apache.org.
|
---|
| 30 | *
|
---|
| 31 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 32 | * nor may "Apache" appear in their name, without prior written
|
---|
| 33 | * permission of the Apache Software Foundation.
|
---|
| 34 | *
|
---|
| 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 46 | * SUCH DAMAGE.
|
---|
| 47 | * ====================================================================
|
---|
| 48 | *
|
---|
| 49 | * This software consists of voluntary contributions made by many
|
---|
| 50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 51 | * originally based on software copyright (c) 1999, International
|
---|
| 52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 53 | * on the Apache Software Foundation, please see
|
---|
| 54 | * <http://www.apache.org/>.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * $Log: IXMLDOMNodeImpl.h,v $
|
---|
| 59 | * Revision 1.4 2004/02/12 13:49:43 amassari
|
---|
| 60 | * Updated version to 2.5
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.3 2003/11/21 12:05:48 amassari
|
---|
| 63 | * Updated version to 2.4
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.2 2003/03/14 12:44:49 tng
|
---|
| 66 | * [Bug 17147] C++ namespace breaks build of XercesCOM DLL
|
---|
| 67 | *
|
---|
| 68 | * Revision 1.1.1.1 2002/02/01 22:21:39 peiyongz
|
---|
| 69 | * sane_include
|
---|
| 70 | *
|
---|
| 71 | * Revision 1.6 2001/05/11 13:25:00 tng
|
---|
| 72 | * Copyright update.
|
---|
| 73 | *
|
---|
| 74 | * Revision 1.5 2001/01/19 15:17:54 tng
|
---|
| 75 | * COM Updates by Curt Arnold: changed 1.3 to 1.4, updated the GUID's so
|
---|
| 76 | * both can coexist and fixed a new minor bugs. Most of the changes involved
|
---|
| 77 | * error reporting, now a DOM defined error will return an HRESULT of
|
---|
| 78 | * 0x80040600 + code and will set an error description to the error name.
|
---|
| 79 | *
|
---|
| 80 | * Revision 1.4 2000/06/19 20:05:56 rahulj
|
---|
| 81 | * Changes for increased conformance and stability. Submitted by
|
---|
| 82 | * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
|
---|
| 83 | *
|
---|
| 84 | * Revision 1.3 2000/06/03 00:28:54 andyh
|
---|
| 85 | * COM Wrapper changes from Curt Arnold
|
---|
| 86 | *
|
---|
| 87 | * Revision 1.2 2000/03/30 02:00:12 abagchi
|
---|
| 88 | * Initial checkin of working code with Copyright Notice
|
---|
| 89 | *
|
---|
| 90 | */
|
---|
| 91 |
|
---|
| 92 | #ifndef ___ixmldomnodeimpl_h___
|
---|
| 93 | #define ___ixmldomnodeimpl_h___
|
---|
| 94 |
|
---|
| 95 | #include <xercesc/util/XercesDefs.hpp>
|
---|
| 96 | #include <xercesc/dom/deprecated/DOM_DOMException.hpp>
|
---|
| 97 | XERCES_CPP_NAMESPACE_USE
|
---|
| 98 |
|
---|
| 99 |
|
---|
| 100 | //
|
---|
| 101 | // This macro is defined in MSXML.H's compatible with IE5
|
---|
| 102 | // and not defined in those from IE4.
|
---|
| 103 | //
|
---|
| 104 | // To correct, install a IE5 or later version of the Microsoft Platform SDK
|
---|
| 105 | // and add \Program Files\Microsoft Platform SDK\Include as the first entry
|
---|
| 106 | // on the Directories tab on the dialog displayed after selecting Tools Options
|
---|
| 107 | // from the Visual Studio IDE.
|
---|
| 108 | //
|
---|
| 109 | // See http://xml.apache.org/xerces-c/build.html#BuildCOM
|
---|
| 110 | #ifndef __IXMLDOMNode_INTERFACE_DEFINED__
|
---|
| 111 | #error "xerces-dom requires an MSXML.H compatible with IE5 or later. See http://xml.apache.org/xerces-c/build.html#BuildCOM for directions to correct this problem."
|
---|
| 112 | #endif
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | template <class T, const IID* piid, class tihclass = CComTypeInfoHolder>
|
---|
| 116 | class ATL_NO_VTABLE IXMLDOMNodeImpl:
|
---|
| 117 | public IDispatchImpl<T,piid,&LIBID_Xerces, 2, 50,tihclass>,
|
---|
| 118 | public IIBMXMLDOMNodeIdentity,
|
---|
| 119 | public ISupportErrorInfo
|
---|
| 120 | {
|
---|
| 121 | public:
|
---|
| 122 |
|
---|
| 123 | IXMLDOMNodeImpl()
|
---|
| 124 | :m_pIXMLDOMDocument(NULL)
|
---|
| 125 | {}
|
---|
| 126 |
|
---|
| 127 | virtual DOM_Node& get_DOM_Node() = 0;
|
---|
| 128 | virtual DOMNodeType get_DOMNodeType() const = 0;
|
---|
| 129 |
|
---|
| 130 | void SetOwnerDoc(IXMLDOMDocument *p)
|
---|
| 131 | {
|
---|
| 132 | m_pIXMLDOMDocument = p;
|
---|
| 133 | if (m_pIXMLDOMDocument != NULL)
|
---|
| 134 | m_pIXMLDOMDocument->AddRef();
|
---|
| 135 | }
|
---|
| 136 |
|
---|
| 137 | // IIBMXMLDOMNodeIdentity
|
---|
| 138 | STDMETHOD(get_NodeId)(long *pVal)
|
---|
| 139 | {
|
---|
| 140 | ATLTRACE(_T("IXMLDOMNodeImpl::get_NodeId\n"));
|
---|
| 141 |
|
---|
| 142 | if (NULL == pVal)
|
---|
| 143 | return E_POINTER;
|
---|
| 144 |
|
---|
| 145 | *pVal = reinterpret_cast<long> (&get_DOM_Node());
|
---|
| 146 | return S_OK;
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | // ISupportErrorInfo
|
---|
| 150 | HRESULT STDMETHODCALLTYPE InterfaceSupportsErrorInfo(REFIID iid);
|
---|
| 151 |
|
---|
| 152 |
|
---|
| 153 | // IXMLDOMNode
|
---|
| 154 | STDMETHOD(get_nodeName)(BSTR *pVal);
|
---|
| 155 | STDMETHOD(get_nodeValue)(VARIANT *pVal);
|
---|
| 156 | STDMETHOD(put_nodeValue)(VARIANT newVal);
|
---|
| 157 | STDMETHOD(get_nodeType)(DOMNodeType *pVal);
|
---|
| 158 | STDMETHOD(get_parentNode)(IXMLDOMNode * *pVal);
|
---|
| 159 | STDMETHOD(get_childNodes)(IXMLDOMNodeList * *pVal);
|
---|
| 160 | STDMETHOD(get_firstChild)(IXMLDOMNode * *pVal);
|
---|
| 161 | STDMETHOD(get_lastChild)(IXMLDOMNode * *pVal);
|
---|
| 162 | STDMETHOD(get_previousSibling)(IXMLDOMNode * *pVal);
|
---|
| 163 | STDMETHOD(get_nextSibling)(IXMLDOMNode * *pVal);
|
---|
| 164 | STDMETHOD(get_attributes)(IXMLDOMNamedNodeMap * *pVal);
|
---|
| 165 | STDMETHOD(insertBefore)(IXMLDOMNode *newChild, VARIANT refChild, IXMLDOMNode * *outNewChild);
|
---|
| 166 | STDMETHOD(replaceChild)(IXMLDOMNode *newChild, IXMLDOMNode *oldChild, IXMLDOMNode * *outNewChild);
|
---|
| 167 | STDMETHOD(removeChild)(IXMLDOMNode *childNode, IXMLDOMNode * *oldChild);
|
---|
| 168 | STDMETHOD(appendChild)(IXMLDOMNode *newChild, IXMLDOMNode * *outNewChild);
|
---|
| 169 | STDMETHOD(hasChildNodes)(VARIANT_BOOL *hasChild);
|
---|
| 170 | STDMETHOD(get_ownerDocument)(IXMLDOMDocument * *pVal);
|
---|
| 171 | STDMETHOD(cloneNode)(VARIANT_BOOL deep, IXMLDOMNode * *cloneRoot);
|
---|
| 172 | STDMETHOD(get_nodeTypeString)(BSTR *pVal);
|
---|
| 173 | STDMETHOD(get_text)(BSTR *pVal);
|
---|
| 174 | STDMETHOD(put_text)(BSTR newVal);
|
---|
| 175 | STDMETHOD(get_specified)(VARIANT_BOOL *pVal);
|
---|
| 176 | STDMETHOD(get_definition)(IXMLDOMNode * *pVal);
|
---|
| 177 | STDMETHOD(get_nodeTypedValue)(VARIANT *pVal);
|
---|
| 178 | STDMETHOD(put_nodeTypedValue)(VARIANT newVal);
|
---|
| 179 | STDMETHOD(get_dataType)(VARIANT *pVal);
|
---|
| 180 | STDMETHOD(put_dataType)(BSTR dataTypeName);
|
---|
| 181 | STDMETHOD(get_xml)(BSTR *pVal);
|
---|
| 182 | STDMETHOD(transformNode)(IXMLDOMNode *stylesheet, BSTR *xmlString);
|
---|
| 183 | STDMETHOD(selectNodes)(BSTR queryString, IXMLDOMNodeList * *resultList);
|
---|
| 184 | STDMETHOD(selectSingleNode)(BSTR queryString, IXMLDOMNode * *resultNode);
|
---|
| 185 | STDMETHOD(get_parsed)(VARIANT_BOOL *pVal);
|
---|
| 186 | STDMETHOD(get_namespaceURI)(BSTR *pVal);
|
---|
| 187 | STDMETHOD(get_prefix)(BSTR *pVal);
|
---|
| 188 | STDMETHOD(get_baseName)(BSTR *pVal);
|
---|
| 189 | STDMETHOD(transformNodeToObject)(IXMLDOMNode *stylesheet, VARIANT outputObject);
|
---|
| 190 |
|
---|
| 191 | protected:
|
---|
| 192 |
|
---|
| 193 | IXMLDOMDocument *m_pIXMLDOMDocument;
|
---|
| 194 |
|
---|
| 195 | void ReleaseOwnerDoc()
|
---|
| 196 | {
|
---|
| 197 | if (m_pIXMLDOMDocument != NULL) {
|
---|
| 198 | m_pIXMLDOMDocument->Release();
|
---|
| 199 | m_pIXMLDOMDocument = NULL;
|
---|
| 200 | }
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | };
|
---|
| 204 |
|
---|
| 205 | class XERCES_CPP_NAMESPACE_QUALIFIER DOM_DOMException;
|
---|
| 206 | HRESULT MakeHRESULT(DOM_DOMException& ex);
|
---|
| 207 |
|
---|
| 208 | #include "IXMLDOMNodeImpl.inl"
|
---|
| 209 |
|
---|
| 210 | #endif // ___ixmldomnodeimpl_h___
|
---|