• Classes
  • Modules
  • Namespaces
  • Files
  • Related Pages
  • File List
  • File Members

XMLDOMDocument.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  * 
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  * 
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 /*
00019  * $Id: XMLDOMDocument.h 568078 2007-08-21 11:43:25Z amassari $
00020  */
00021 
00022 #ifndef ___xmldomdocument_h___
00023 #define ___xmldomdocument_h___
00024 
00025 #include <xercesc/dom/DOMDocument.hpp>
00026 #include "IXMLDOMNodeImpl.h"
00027 
00028 #include "resource.h"       // main symbols
00029 #include "XMLDOMParseError.h"
00030 
00031 #include <xercesc/sax/ErrorHandler.hpp>
00032 #include "xml4comCP.h"
00033 
00034 XERCES_CPP_NAMESPACE_USE
00035 
00036 class XERCES_CPP_NAMESPACE_QUALIFIER SAXParseException;
00037 
00038 class ATL_NO_VTABLE CXMLDOMDocument :
00039         public CComObjectRootEx<CComSingleThreadModel>,
00040         public CComCoClass<CXMLDOMDocument, &CLSID_DOMDocument>,
00041         public IObjectSafetyImpl<CXMLDOMDocument, INTERFACESAFE_FOR_UNTRUSTED_CALLER>,
00042         public IXMLDOMNodeImpl<IXMLDOMDocument, &IID_IXMLDOMDocument>,
00043         public IObjectWithSiteImpl<CXMLDOMDocument>,
00044         public CProxyXMLDOMDocumentEvents< CXMLDOMDocument >,
00045         public IConnectionPointContainerImpl<CXMLDOMDocument>,
00046         public IProvideClassInfo2Impl<&CLSID_DOMDocument, &DIID_XMLDOMDocumentEvents, &LIBID_Xerces, XERCES_VERSION_MAJOR, INVK_CAT2_RAW_NUMERIC(XERCES_VERSION_MINOR,XERCES_VERSION_REVISION)>,
00047         public CWindowImpl<CXMLDOMDocument, CWindow, CWinTraits<0,0> >,
00048         ErrorHandler
00049 {
00050 public:
00051         CXMLDOMDocument();
00052 
00053         HRESULT FinalConstruct();
00054         void    FinalRelease();
00055 
00056         virtual DOMNode*        get_DOMNode()               { return m_Document;}
00057     virtual DOMNodeType     get_DOMNodeType() const { return NODE_DOCUMENT; }
00058 
00059         virtual void resetErrors() {};
00060 
00061         //DECLARE_REGISTRY_RESOURCEID(IDR_XMLDOCUMENT)
00062         static HRESULT WINAPI UpdateRegistry(BOOL bRegister);
00063 
00064 DECLARE_NOT_AGGREGATABLE(CXMLDOMDocument)
00065 
00066 DECLARE_PROTECT_FINAL_CONSTRUCT()
00067 
00068 BEGIN_COM_MAP(CXMLDOMDocument)
00069         COM_INTERFACE_ENTRY(IXMLDOMDocument)
00070         COM_INTERFACE_ENTRY(IXMLDOMNode)
00071         COM_INTERFACE_ENTRY(IDispatch)
00072         COM_INTERFACE_ENTRY(IIBMXMLDOMNodeIdentity)
00073         COM_INTERFACE_ENTRY(IObjectSafety)
00074         COM_INTERFACE_ENTRY(IObjectWithSite)
00075         COM_INTERFACE_ENTRY(ISupportErrorInfo)
00076         COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
00077         COM_INTERFACE_ENTRY(IProvideClassInfo)
00078         COM_INTERFACE_ENTRY(IProvideClassInfo2)
00079         COM_INTERFACE_ENTRY(ISupportErrorInfo)
00080 END_COM_MAP()
00081 
00082 BEGIN_CONNECTION_POINT_MAP(CXMLDOMDocument)
00083         CONNECTION_POINT_ENTRY(DIID_XMLDOMDocumentEvents)
00084 END_CONNECTION_POINT_MAP()
00085 
00086         DECLARE_WND_CLASS(_T("XMLParseMonitor"))
00087 
00088 BEGIN_MSG_MAP(CMonitorWnd)
00089         MESSAGE_HANDLER(MSG_READY_STATE_CHANGE, OnReadyStateChange)
00090 END_MSG_MAP()
00091 
00092         LRESULT OnReadyStateChange(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
00093 
00094         // ISupportsErrorInfo
00095         STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
00096 
00097         // IXMLDOMDocument methods
00098         STDMETHOD(get_doctype)(IXMLDOMDocumentType  * *pVal);
00099         STDMETHOD(get_implementation)(IXMLDOMImplementation  * *pVal);
00100         STDMETHOD(get_documentElement)(IXMLDOMElement  * *pVal);
00101         STDMETHOD(putref_documentElement)(IXMLDOMElement  *newVal);
00102         STDMETHOD(createElement)(BSTR tagName, IXMLDOMElement  * *element);
00103         STDMETHOD(createDocumentFragment)(IXMLDOMDocumentFragment  * *docFrag);
00104         STDMETHOD(createTextNode)(BSTR data, IXMLDOMText  * *text);
00105         STDMETHOD(createComment)(BSTR data, IXMLDOMComment  * *comment);
00106         STDMETHOD(createCDATASection)(BSTR data, IXMLDOMCDATASection  * *cdata);
00107         STDMETHOD(createProcessingInstruction)(BSTR target, BSTR data, IXMLDOMProcessingInstruction  * *pVal);
00108         STDMETHOD(createAttribute)(BSTR name, IXMLDOMAttribute  * *attr);
00109         STDMETHOD(createEntityReference)(BSTR name, IXMLDOMEntityReference  * *entityRef);
00110         STDMETHOD(getElementsByTagName)(BSTR tagName, IXMLDOMNodeList  * *resultList);
00111         STDMETHOD(createNode)(VARIANT type, BSTR name, BSTR namespaceURI, IXMLDOMNode  * *node);
00112         STDMETHOD(nodeFromID)(BSTR idString, IXMLDOMNode  * *node);
00113         STDMETHOD(load)(VARIANT xmlSource, VARIANT_BOOL  *isSuccessful);
00114         STDMETHOD(get_readyState)(long  *pVal);
00115         STDMETHOD(get_parseError)(IXMLDOMParseError  * *pVal);
00116         STDMETHOD(get_url)(BSTR  *pVal);
00117         STDMETHOD(get_async)(VARIANT_BOOL  *pVal);
00118         STDMETHOD(put_async)(VARIANT_BOOL newVal);
00119         STDMETHOD(abort)(void);
00120         STDMETHOD(loadXML)(BSTR bstrXML, VARIANT_BOOL  *success);
00121         STDMETHOD(save)(VARIANT location);
00122         STDMETHOD(get_validateOnParse)(VARIANT_BOOL  *pVal);
00123         STDMETHOD(put_validateOnParse)(VARIANT_BOOL newVal);
00124         STDMETHOD(get_resolveExternals)(VARIANT_BOOL  *pVal);
00125         STDMETHOD(put_resolveExternals)(VARIANT_BOOL newVal);
00126         STDMETHOD(get_preserveWhiteSpace)(VARIANT_BOOL  *pVal);
00127         STDMETHOD(put_preserveWhiteSpace)(VARIANT_BOOL newVal);
00128         STDMETHOD(put_onreadystatechange)(VARIANT newVal);
00129         STDMETHOD(put_ondataavailable)(VARIANT newVal);
00130         STDMETHOD(put_ontransformnode)(VARIANT newVal);
00131 
00132         // Error handling
00133         virtual void warning(const SAXParseException& exc);
00134         virtual void error(const SAXParseException& exc);
00135     virtual void fatalError(const SAXParseException& exc);
00136 
00137         bool IsAbort() const { return m_bAbort; }
00138 
00139         XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument*               m_Document;
00140 
00141 private:
00142 
00143         bool                              m_bValidate;
00144         long                              m_lReadyState;
00145         _bstr_t                       m_url;
00146         CXMLDOMParseErrorObj *m_pParseError;
00147         bool                          m_bAsync; 
00148         bool                              m_bAbort;
00149         HANDLE                            m_hParseThread;
00150         LPDISPATCH                        m_pOnReadyStateChange;
00151         LPDISPATCH                        m_pOnDataAvailable;
00152         LPDISPATCH                        m_pOnTransformNode;
00153 
00154         // thread data
00155         _bstr_t                           m_FileName;
00156         _bstr_t                           m_xml;
00157         XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument*               m_TmpDocument;
00158         bool                          m_bParseError;
00159         bool                              m_bThreadValidate;
00160         bool                  m_bPreserveWhiteSpace;
00161         
00162         HRESULT GetBaseURL(_bstr_t &baseURL);
00163         
00164         static UINT APIENTRY ParseThread(void *pParm);
00165 };
00166 
00167 typedef CComObject<CXMLDOMDocument> CXMLDOMDocumentObj;
00168 
00169 #endif // ___xmldomdocument_h___

Generated on Thu Jan 12 2012 23:13:51 for ACS-10.0 C++ API by  doxygen 1.7.0