Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

XMLDOMDocument.h

Go to the documentation of this file.
00001 /* 00002 * Copyright 1999-2001,2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /* 00018 * $Log: XMLDOMDocument.h,v $ 00019 * Revision 1.9 2004/09/08 13:55:35 peiyongz 00020 * Apache License Version 2.0 00021 * 00022 * Revision 1.8 2004/02/25 18:38:33 amassari 00023 * The COM wrapper doesn't use the deprecated DOM anymore 00024 * 00025 * Revision 1.7 2004/02/12 13:49:43 amassari 00026 * Updated version to 2.5 00027 * 00028 * Revision 1.6 2003/12/02 14:33:13 amassari 00029 * Don't use the word "exception" as a variable name, as VC 7.1 complains about it 00030 * 00031 * Revision 1.5 2003/11/21 12:05:48 amassari 00032 * Updated version to 2.4 00033 * 00034 * Revision 1.4 2003/10/21 21:21:32 amassari 00035 * When the COM object is loaded by a late-binding engine (like WSH, or 00036 * Visual Basic when the type library is not preloaded in the editor), the type 00037 * library version stored in the resource must match the version specified in the 00038 * IDispatchImpl template (defaulted to 1.0), or trying to invoke a method will fail 00039 * 00040 * Revision 1.3 2003/03/14 12:44:49 tng 00041 * [Bug 17147] C++ namespace breaks build of XercesCOM DLL 00042 * 00043 * Revision 1.2 2002/05/21 19:53:53 tng 00044 * DOM Reorganization: update include path for the old DOM interface in COM files 00045 * 00046 * Revision 1.1.1.1 2002/02/01 22:21:40 peiyongz 00047 * sane_include 00048 * 00049 * Revision 1.6 2001/05/11 13:25:03 tng 00050 * Copyright update. 00051 * 00052 * Revision 1.5 2001/01/19 15:18:10 tng 00053 * COM Updates by Curt Arnold: changed 1.3 to 1.4, updated the GUID's so 00054 * both can coexist and fixed a new minor bugs. Most of the changes involved 00055 * error reporting, now a DOM defined error will return an HRESULT of 00056 * 0x80040600 + code and will set an error description to the error name. 00057 * 00058 * Revision 1.4 2000/06/19 20:05:58 rahulj 00059 * Changes for increased conformance and stability. Submitted by 00060 * Curt.Arnold@hyprotech.com. Verified by Joe Polastre. 00061 * 00062 * Revision 1.3 2000/06/03 00:28:57 andyh 00063 * COM Wrapper changes from Curt Arnold 00064 * 00065 * Revision 1.2 2000/03/30 02:00:11 abagchi 00066 * Initial checkin of working code with Copyright Notice 00067 * 00068 */ 00069 00070 #ifndef ___xmldomdocument_h___ 00071 #define ___xmldomdocument_h___ 00072 00073 #include <xercesc/dom/DOMDocument.hpp> 00074 #include "IXMLDOMNodeImpl.h" 00075 00076 #include "resource.h" // main symbols 00077 #include "XMLDOMParseError.h" 00078 00079 #include <xercesc/sax/ErrorHandler.hpp> 00080 #include "xml4comCP.h" 00081 00082 XERCES_CPP_NAMESPACE_USE 00083 00084 class XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException; 00085 00086 class ATL_NO_VTABLE CXMLDOMDocument : 00087 public CComObjectRootEx<CComSingleThreadModel>, 00088 public CComCoClass<CXMLDOMDocument, &CLSID_DOMDocument>, 00089 public IObjectSafetyImpl<CXMLDOMDocument, INTERFACESAFE_FOR_UNTRUSTED_CALLER>, 00090 public IXMLDOMNodeImpl<IXMLDOMDocument, &IID_IXMLDOMDocument>, 00091 public IObjectWithSiteImpl<CXMLDOMDocument>, 00092 public CProxyXMLDOMDocumentEvents< CXMLDOMDocument >, 00093 public IConnectionPointContainerImpl<CXMLDOMDocument>, 00094 public IProvideClassInfo2Impl<&CLSID_DOMDocument, &DIID_XMLDOMDocumentEvents, &LIBID_Xerces, 2, 50>, 00095 public CWindowImpl<CXMLDOMDocument, CWindow, CWinTraits<0,0> >, 00096 ErrorHandler 00097 { 00098 public: 00099 CXMLDOMDocument(); 00100 00101 HRESULT FinalConstruct(); 00102 void FinalRelease(); 00103 00104 virtual DOMNode* get_DOMNode() { return m_Document;} 00105 virtual DOMNodeType get_DOMNodeType() const { return NODE_DOCUMENT; } 00106 00107 virtual void resetErrors() {}; 00108 00109 //DECLARE_REGISTRY_RESOURCEID(IDR_XMLDOCUMENT) 00110 static HRESULT WINAPI UpdateRegistry(BOOL bRegister); 00111 00112 DECLARE_NOT_AGGREGATABLE(CXMLDOMDocument) 00113 00114 DECLARE_PROTECT_FINAL_CONSTRUCT() 00115 00116 BEGIN_COM_MAP(CXMLDOMDocument) 00117 COM_INTERFACE_ENTRY(IXMLDOMDocument) 00118 COM_INTERFACE_ENTRY(IXMLDOMNode) 00119 COM_INTERFACE_ENTRY(IDispatch) 00120 COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity) 00121 COM_INTERFACE_ENTRY(IObjectSafety) 00122 COM_INTERFACE_ENTRY(IObjectWithSite) 00123 COM_INTERFACE_ENTRY(ISupportErrorInfo) 00124 COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer) 00125 COM_INTERFACE_ENTRY(IProvideClassInfo) 00126 COM_INTERFACE_ENTRY(IProvideClassInfo2) 00127 COM_INTERFACE_ENTRY(ISupportErrorInfo) 00128 END_COM_MAP() 00129 00130 BEGIN_CONNECTION_POINT_MAP(CXMLDOMDocument) 00131 CONNECTION_POINT_ENTRY(DIID_XMLDOMDocumentEvents) 00132 END_CONNECTION_POINT_MAP() 00133 00134 DECLARE_WND_CLASS(_T("XMLParseMonitor")) 00135 00136 BEGIN_MSG_MAP(CMonitorWnd) 00137 MESSAGE_HANDLER(MSG_READY_STATE_CHANGE, OnReadyStateChange) 00138 END_MSG_MAP() 00139 00140 LRESULT OnReadyStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled); 00141 00142 // ISupportsErrorInfo 00143 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); 00144 00145 // IXMLDOMDocument methods 00146 STDMETHOD(get_doctype)(IXMLDOMDocumentType * *pVal); 00147 STDMETHOD(get_implementation)(IXMLDOMImplementation * *pVal); 00148 STDMETHOD(get_documentElement)(IXMLDOMElement * *pVal); 00149 STDMETHOD(putref_documentElement)(IXMLDOMElement *newVal); 00150 STDMETHOD(createElement)(BSTR tagName, IXMLDOMElement * *element); 00151 STDMETHOD(createDocumentFragment)(IXMLDOMDocumentFragment * *docFrag); 00152 STDMETHOD(createTextNode)(BSTR data, IXMLDOMText * *text); 00153 STDMETHOD(createComment)(BSTR data, IXMLDOMComment * *comment); 00154 STDMETHOD(createCDATASection)(BSTR data, IXMLDOMCDATASection * *cdata); 00155 STDMETHOD(createProcessingInstruction)(BSTR target, BSTR data, IXMLDOMProcessingInstruction * *pVal); 00156 STDMETHOD(createAttribute)(BSTR name, IXMLDOMAttribute * *attr); 00157 STDMETHOD(createEntityReference)(BSTR name, IXMLDOMEntityReference * *entityRef); 00158 STDMETHOD(getElementsByTagName)(BSTR tagName, IXMLDOMNodeList * *resultList); 00159 STDMETHOD(createNode)(VARIANT type, BSTR name, BSTR namespaceURI, IXMLDOMNode * *node); 00160 STDMETHOD(nodeFromID)(BSTR idString, IXMLDOMNode * *node); 00161 STDMETHOD(load)(VARIANT xmlSource, VARIANT_BOOL *isSuccessful); 00162 STDMETHOD(get_readyState)(long *pVal); 00163 STDMETHOD(get_parseError)(IXMLDOMParseError * *pVal); 00164 STDMETHOD(get_url)(BSTR *pVal); 00165 STDMETHOD(get_async)(VARIANT_BOOL *pVal); 00166 STDMETHOD(put_async)(VARIANT_BOOL newVal); 00167 STDMETHOD(abort)(void); 00168 STDMETHOD(loadXML)(BSTR bstrXML, VARIANT_BOOL *success); 00169 STDMETHOD(save)(VARIANT location); 00170 STDMETHOD(get_validateOnParse)(VARIANT_BOOL *pVal); 00171 STDMETHOD(put_validateOnParse)(VARIANT_BOOL newVal); 00172 STDMETHOD(get_resolveExternals)(VARIANT_BOOL *pVal); 00173 STDMETHOD(put_resolveExternals)(VARIANT_BOOL newVal); 00174 STDMETHOD(get_preserveWhiteSpace)(VARIANT_BOOL *pVal); 00175 STDMETHOD(put_preserveWhiteSpace)(VARIANT_BOOL newVal); 00176 STDMETHOD(put_onreadystatechange)(VARIANT newVal); 00177 STDMETHOD(put_ondataavailable)(VARIANT newVal); 00178 STDMETHOD(put_ontransformnode)(VARIANT newVal); 00179 00180 // Error handling 00181 virtual void warning(const SAXParseException& exc); 00182 virtual void error(const SAXParseException& exc); 00183 virtual void fatalError(const SAXParseException& exc); 00184 00185 bool IsAbort() const { return m_bAbort; } 00186 00187 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* m_Document; 00188 00189 private: 00190 00191 bool m_bValidate; 00192 long m_lReadyState; 00193 _bstr_t m_url; 00194 CXMLDOMParseErrorObj *m_pParseError; 00195 bool m_bAsync; 00196 bool m_bAbort; 00197 HANDLE m_hParseThread; 00198 LPDISPATCH m_pOnReadyStateChange; 00199 LPDISPATCH m_pOnDataAvailable; 00200 LPDISPATCH m_pOnTransformNode; 00201 00202 // thread data 00203 _bstr_t m_FileName; 00204 _bstr_t m_xml; 00205 XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument* m_TmpDocument; 00206 bool m_bParseError; 00207 bool m_bThreadValidate; 00208 bool m_bPreserveWhiteSpace; 00209 00210 HRESULT GetBaseURL(_bstr_t &baseURL); 00211 00212 static UINT APIENTRY ParseThread(void *pParm); 00213 }; 00214 00215 typedef CComObject<CXMLDOMDocument> CXMLDOMDocumentObj; 00216 00217 #endif // ___xmldomdocument_h___

Generated on Thu Apr 30 02:30:52 2009 for ACS C++ API by doxygen 1.3.8