source: trunk/VUT/GtpVisibilityPreprocessor/support/xercesc/com/XMLDOMDocument.h @ 188

Revision 188, 9.7 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
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: XMLDOMDocument.h,v $
59 * Revision 1.7  2004/02/12 13:49:43  amassari
60 * Updated version to 2.5
61 *
62 * Revision 1.6  2003/12/02 14:33:13  amassari
63 * Don't use the word "exception" as a variable name, as VC 7.1 complains about it
64 *
65 * Revision 1.5  2003/11/21 12:05:48  amassari
66 * Updated version to 2.4
67 *
68 * Revision 1.4  2003/10/21 21:21:32  amassari
69 * When the COM object is loaded by a late-binding engine (like WSH, or
70 * Visual Basic when the type library is not preloaded in the editor), the type
71 * library version stored in the resource must match the version specified in the
72 * IDispatchImpl template (defaulted to 1.0), or trying to invoke a method will fail
73 *
74 * Revision 1.3  2003/03/14 12:44:49  tng
75 * [Bug 17147] C++ namespace breaks build of XercesCOM DLL
76 *
77 * Revision 1.2  2002/05/21 19:53:53  tng
78 * DOM Reorganization: update include path for the old DOM interface in COM files
79 *
80 * Revision 1.1.1.1  2002/02/01 22:21:40  peiyongz
81 * sane_include
82 *
83 * Revision 1.6  2001/05/11 13:25:03  tng
84 * Copyright update.
85 *
86 * Revision 1.5  2001/01/19 15:18:10  tng
87 * COM Updates by Curt Arnold: changed 1.3 to 1.4, updated the GUID's so
88 * both can coexist and fixed a new minor bugs.  Most of the changes involved
89 * error reporting, now a DOM defined error will return an HRESULT of
90 * 0x80040600 + code and will set an error description to the error name.
91 *
92 * Revision 1.4  2000/06/19 20:05:58  rahulj
93 * Changes for increased conformance and stability. Submitted by
94 * Curt.Arnold@hyprotech.com. Verified by Joe Polastre.
95 *
96 * Revision 1.3  2000/06/03 00:28:57  andyh
97 * COM Wrapper changes from Curt Arnold
98 *
99 * Revision 1.2  2000/03/30 02:00:11  abagchi
100 * Initial checkin of working code with Copyright Notice
101 *
102 */
103
104#ifndef ___xmldomdocument_h___
105#define ___xmldomdocument_h___
106
107#include <xercesc/dom/deprecated/DOM_Document.hpp>
108#include "IXMLDOMNodeImpl.h"
109
110#include "resource.h"       // main symbols
111#include "XMLDOMParseError.h"
112
113#include <xercesc/sax/ErrorHandler.hpp>
114#include "xml4comCP.h"
115
116XERCES_CPP_NAMESPACE_USE
117
118class XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException;
119
120class ATL_NO_VTABLE CXMLDOMDocument :
121        public CComObjectRootEx<CComSingleThreadModel>,
122        public CComCoClass<CXMLDOMDocument, &CLSID_DOMDocument>,
123        public IObjectSafetyImpl<CXMLDOMDocument, INTERFACESAFE_FOR_UNTRUSTED_CALLER>,
124        public IXMLDOMNodeImpl<IXMLDOMDocument, &IID_IXMLDOMDocument>,
125        public IObjectWithSiteImpl<CXMLDOMDocument>,
126        public CProxyXMLDOMDocumentEvents< CXMLDOMDocument >,
127        public IConnectionPointContainerImpl<CXMLDOMDocument>,
128        public IProvideClassInfo2Impl<&CLSID_DOMDocument, &DIID_XMLDOMDocumentEvents, &LIBID_Xerces, 2, 50>,
129        public CWindowImpl<CXMLDOMDocument, CWindow, CWinTraits<0,0> >,
130        ErrorHandler
131{
132public:
133        CXMLDOMDocument();
134
135        HRESULT FinalConstruct();
136        void    FinalRelease();
137
138        virtual DOM_Node&   get_DOM_Node()                       { return m_Document;}
139        virtual DOMNodeType get_DOMNodeType() const  { return NODE_DOCUMENT; }
140
141        virtual void resetErrors() {};
142
143        //DECLARE_REGISTRY_RESOURCEID(IDR_XMLDOCUMENT)
144        static HRESULT WINAPI UpdateRegistry(BOOL bRegister);
145
146DECLARE_NOT_AGGREGATABLE(CXMLDOMDocument)
147
148DECLARE_PROTECT_FINAL_CONSTRUCT()
149
150BEGIN_COM_MAP(CXMLDOMDocument)
151        COM_INTERFACE_ENTRY(IXMLDOMDocument)
152        COM_INTERFACE_ENTRY(IXMLDOMNode)
153        COM_INTERFACE_ENTRY(IDispatch)
154        COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity)
155        COM_INTERFACE_ENTRY(IObjectSafety)
156        COM_INTERFACE_ENTRY(IObjectWithSite)
157        COM_INTERFACE_ENTRY(ISupportErrorInfo)
158        COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
159        COM_INTERFACE_ENTRY(IProvideClassInfo)
160        COM_INTERFACE_ENTRY(IProvideClassInfo2)
161        COM_INTERFACE_ENTRY(ISupportErrorInfo)
162END_COM_MAP()
163
164BEGIN_CONNECTION_POINT_MAP(CXMLDOMDocument)
165        CONNECTION_POINT_ENTRY(DIID_XMLDOMDocumentEvents)
166END_CONNECTION_POINT_MAP()
167
168        DECLARE_WND_CLASS(_T("XMLParseMonitor"))
169
170BEGIN_MSG_MAP(CMonitorWnd)
171        MESSAGE_HANDLER(MSG_READY_STATE_CHANGE, OnReadyStateChange)
172END_MSG_MAP()
173
174        LRESULT OnReadyStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
175
176        // ISupportsErrorInfo
177        STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
178
179        // IXMLDOMDocument methods
180        STDMETHOD(get_doctype)(IXMLDOMDocumentType  * *pVal);
181        STDMETHOD(get_implementation)(IXMLDOMImplementation  * *pVal);
182        STDMETHOD(get_documentElement)(IXMLDOMElement  * *pVal);
183        STDMETHOD(putref_documentElement)(IXMLDOMElement  *newVal);
184        STDMETHOD(createElement)(BSTR tagName, IXMLDOMElement  * *element);
185        STDMETHOD(createDocumentFragment)(IXMLDOMDocumentFragment  * *docFrag);
186        STDMETHOD(createTextNode)(BSTR data, IXMLDOMText  * *text);
187        STDMETHOD(createComment)(BSTR data, IXMLDOMComment  * *comment);
188        STDMETHOD(createCDATASection)(BSTR data, IXMLDOMCDATASection  * *cdata);
189        STDMETHOD(createProcessingInstruction)(BSTR target, BSTR data, IXMLDOMProcessingInstruction  * *pVal);
190        STDMETHOD(createAttribute)(BSTR name, IXMLDOMAttribute  * *attr);
191        STDMETHOD(createEntityReference)(BSTR name, IXMLDOMEntityReference  * *entityRef);
192        STDMETHOD(getElementsByTagName)(BSTR tagName, IXMLDOMNodeList  * *resultList);
193        STDMETHOD(createNode)(VARIANT type, BSTR name, BSTR namespaceURI, IXMLDOMNode  * *node);
194        STDMETHOD(nodeFromID)(BSTR idString, IXMLDOMNode  * *node);
195        STDMETHOD(load)(VARIANT xmlSource, VARIANT_BOOL  *isSuccessful);
196        STDMETHOD(get_readyState)(long  *pVal);
197        STDMETHOD(get_parseError)(IXMLDOMParseError  * *pVal);
198        STDMETHOD(get_url)(BSTR  *pVal);
199        STDMETHOD(get_async)(VARIANT_BOOL  *pVal);
200        STDMETHOD(put_async)(VARIANT_BOOL newVal);
201        STDMETHOD(abort)(void);
202        STDMETHOD(loadXML)(BSTR bstrXML, VARIANT_BOOL  *success);
203        STDMETHOD(save)(VARIANT location);
204        STDMETHOD(get_validateOnParse)(VARIANT_BOOL  *pVal);
205        STDMETHOD(put_validateOnParse)(VARIANT_BOOL newVal);
206        STDMETHOD(get_resolveExternals)(VARIANT_BOOL  *pVal);
207        STDMETHOD(put_resolveExternals)(VARIANT_BOOL newVal);
208        STDMETHOD(get_preserveWhiteSpace)(VARIANT_BOOL  *pVal);
209        STDMETHOD(put_preserveWhiteSpace)(VARIANT_BOOL newVal);
210        STDMETHOD(put_onreadystatechange)(VARIANT newVal);
211        STDMETHOD(put_ondataavailable)(VARIANT newVal);
212        STDMETHOD(put_ontransformnode)(VARIANT newVal);
213
214        // Error handling
215        virtual void warning(const SAXParseException& exc);
216        virtual void error(const SAXParseException& exc);
217    virtual void fatalError(const SAXParseException& exc);
218
219        bool IsAbort() const { return m_bAbort; }
220
221        DOM_Document              m_Document;
222
223private:
224
225        bool                              m_bValidate;
226        long                              m_lReadyState;
227        _bstr_t                       m_url;
228        CXMLDOMParseErrorObj *m_pParseError;
229        bool                          m_bAsync;
230        bool                              m_bAbort;
231        HANDLE                            m_hParseThread;
232        LPDISPATCH                        m_pOnReadyStateChange;
233        LPDISPATCH                        m_pOnDataAvailable;
234        LPDISPATCH                        m_pOnTransformNode;
235
236        // thread data
237        _bstr_t                           m_FileName;
238        _bstr_t                           m_xml;
239        DOM_Document              m_TmpDocument;
240        bool                          m_bParseError;
241        bool                              m_bThreadValidate;
242        bool                  m_bPreserveWhiteSpace;
243       
244        HRESULT GetBaseURL(_bstr_t &baseURL);
245       
246        static UINT APIENTRY ParseThread(void *pParm);
247};
248
249typedef CComObject<CXMLDOMDocument> CXMLDOMDocumentObj;
250
251#endif // ___xmldomdocument_h___
Note: See TracBrowser for help on using the repository browser.