Moved from webshell/embed/ActiveX

This commit is contained in:
locka%iol.ie 2000-03-21 22:22:47 +00:00
parent 83fa6cf316
commit 6a1f81da10
19 changed files with 1973 additions and 0 deletions

View File

@ -0,0 +1,171 @@
#include "stdafx.h"
#define XML_UNICODE
#include "xmlparse.h"
#ifdef XML_UNICODE
#define X2OLE W2COLE
#define X2T W2T
#else
#define X2OLE A2COLE
#define X2T A2T
#endif
struct ParserState
{
CComQIPtr<IXMLDocument, &IID_IXMLDocument> spXMLDocument;
CComQIPtr<IXMLElement, &IID_IXMLElement> spXMLRoot;
CComQIPtr<IXMLElement, &IID_IXMLElement> spXMLParent;
};
static ParserState cParserState;
// XML data handlers
static void OnStartElement(void *userData, const XML_Char *name, const XML_Char **atts);
static void OnEndElement(void *userData, const XML_Char *name);
static void OnCharacterData(void *userData, const XML_Char *s, int len);
static void OnDefault(void *userData, const XML_Char *s, int len);
struct ParseData
{
CComQIPtr<IXMLDocument, &IID_IXMLDocument> spDocument;
CComQIPtr<IXMLElement, &IID_IXMLElement> spRoot;
};
HRESULT ParseExpat(const char *pBuffer, unsigned long cbBufSize, IXMLDocument *pDocument, IXMLElement **ppElement)
{
if (pDocument == NULL)
{
return E_INVALIDARG;
}
XML_Parser parser = XML_ParserCreate(NULL);
HRESULT hr = S_OK;
cParserState.spXMLDocument = pDocument;
pDocument->get_root(&cParserState.spXMLParent);
// Initialise the XML parser
XML_SetUserData(parser, &cParserState);
// Initialise the data handlers
XML_SetElementHandler(parser, OnStartElement, OnEndElement);
XML_SetCharacterDataHandler(parser, OnCharacterData);
XML_SetDefaultHandler(parser, OnDefault);
// Parse the data
if (!XML_Parse(parser, pBuffer, cbBufSize, 1))
{
/* TODO Create error code
fprintf(stderr,
"%s at line %d\n",
XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber(parser));
*/
hr = E_FAIL;
}
// Cleanup
XML_ParserFree(parser);
cParserState.spXMLRoot->QueryInterface(IID_IXMLElement, (void **) ppElement);
cParserState.spXMLDocument.Release();
cParserState.spXMLParent.Release();
return S_OK;
}
///////////////////////////////////////////////////////////////////////////////
void OnStartElement(void *userData, const XML_Char *name, const XML_Char **atts)
{
ParserState *pState = (ParserState *) userData;
if (pState)
{
USES_CONVERSION;
CComQIPtr<IXMLElement, &IID_IXMLElement> spXMLElement;
// Create a new element
pState->spXMLDocument->createElement(
CComVariant(XMLELEMTYPE_ELEMENT),
CComVariant(X2OLE(name)),
&spXMLElement);
if (spXMLElement)
{
// Create each attribute
for (int i = 0; atts[i] != NULL; i += 2)
{
const XML_Char *pszName = atts[i];
const XML_Char *pszValue = atts[i+1];
spXMLElement->setAttribute((BSTR) X2OLE(pszName), CComVariant(X2OLE(pszValue)));
}
if (pState->spXMLRoot == NULL)
{
pState->spXMLRoot = spXMLElement;
}
if (pState->spXMLParent)
{
// Add the element to the end of the list
pState->spXMLParent->addChild(spXMLElement, -1, -1);
}
pState->spXMLParent = spXMLElement;
}
}
}
void OnEndElement(void *userData, const XML_Char *name)
{
ParserState *pState = (ParserState *) userData;
if (pState)
{
CComQIPtr<IXMLElement, &IID_IXMLElement> spNewParent;
if (pState->spXMLParent)
{
pState->spXMLParent->get_parent(&spNewParent);
pState->spXMLParent = spNewParent;
}
}
}
void OnDefault(void *userData, const XML_Char *s, int len)
{
XML_Char *pString = new XML_Char[len + 1];
memset(pString, 0, sizeof(XML_Char) * (len + 1));
memcpy(pString, s, sizeof(XML_Char) * len);
USES_CONVERSION;
ATLTRACE(_T("OnDefault: \"%s\"\n"), X2T(pString));
// TODO test if the buffer contains <?xml version="X"?>
// and store version in XML document
// TODO test if the buffer contains DTD and store it
// in the XML document
// TODO test if the buffer contains a comment, i.e. <!--.*-->
// and create a comment XML element
delete []pString;
}
void OnCharacterData(void *userData, const XML_Char *s, int len)
{
ParserState *pState = (ParserState *) userData;
if (pState)
{
// TODO create TEXT element
}
}

View File

@ -0,0 +1,12 @@
// 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"
#ifdef _ATL_STATIC_REGISTRY
#include <statreg.h>
#include <statreg.cpp>
#endif
#include <atlimpl.cpp>

View File

@ -0,0 +1,40 @@
// 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__45E5B413_2805_11D3_9425_000000000000__INCLUDED_)
#define AFX_STDAFX_H__45E5B413_2805_11D3_9425_000000000000__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
#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 "activexml.h"
extern const CLSID CLSID_MozXMLElement;
extern const CLSID CLSID_MozXMLDocument;
extern const CLSID CLSID_MozXMLElementCollection;
extern const IID LIBID_MozActiveXMLLib;
#include "XMLElement.h"
#include "XMLElementCollection.h"
#include "XMLDocument.h"
extern HRESULT ParseExpat(const char *pBuffer, unsigned long cbBufSize, IXMLDocument *pDocument, IXMLElement **ppElement);
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__45E5B413_2805_11D3_9425_000000000000__INCLUDED)

View File

@ -0,0 +1,328 @@
// XMLDocument.cpp : Implementation of CXMLDocument
#include "stdafx.h"
//#include "Activexml.h"
#include "XMLDocument.h"
CXMLDocument::CXMLDocument()
{
ATLTRACE(_T("CXMLDocument::CXMLDocument()\n"));
m_nReadyState = READYSTATE_COMPLETE;
}
CXMLDocument::~CXMLDocument()
{
}
/////////////////////////////////////////////////////////////////////////////
// CXMLDocument
STDMETHODIMP CXMLDocument::InterfaceSupportsErrorInfo(REFIID riid)
{
static const IID* arr[] =
{
&IID_IXMLDocument
};
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
{
if (InlineIsEqualGUID(*arr[i],riid))
return S_OK;
}
return S_FALSE;
}
/////////////////////////////////////////////////////////////////////////////
// IPersistStreamInit implementation
HRESULT STDMETHODCALLTYPE CXMLDocument::Load(/* [in] */ LPSTREAM pStm)
{
if (pStm == NULL)
{
return E_INVALIDARG;
}
// Load the XML from the stream
STATSTG statstg;
pStm->Stat(&statstg, STATFLAG_NONAME);
ULONG cbBufSize = statstg.cbSize.LowPart;
char *pBuffer = new char[cbBufSize];
if (pBuffer == NULL)
{
return E_OUTOFMEMORY;
}
memset(pBuffer, 0, cbBufSize);
pStm->Read(pBuffer, cbBufSize, NULL);
m_spRoot.Release();
ParseExpat(pBuffer, cbBufSize, (IXMLDocument *) this, &m_spRoot);
delete []pBuffer;
m_nReadyState = READYSTATE_LOADED;
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::Save(/* [in] */ LPSTREAM pStm, /* [in] */ BOOL fClearDirty)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::GetSizeMax(/* [out] */ ULARGE_INTEGER __RPC_FAR *pCbSize)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::InitNew(void)
{
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
// IPersistMoniker implementation
HRESULT STDMETHODCALLTYPE CXMLDocument::GetClassID(/* [out] */ CLSID __RPC_FAR *pClassID)
{
if (pClassID == NULL)
{
return E_INVALIDARG;
}
*pClassID = CLSID_MozXMLDocument;
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::IsDirty(void)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::Load(/* [in] */ BOOL fFullyAvailable, /* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pibc, /* [in] */ DWORD grfMode)
{
if (pimkName == NULL)
{
return E_INVALIDARG;
}
m_nReadyState = READYSTATE_LOADING;
// Bind to the stream specified by the moniker
CComQIPtr<IStream, &IID_IStream> spIStream;
if (FAILED(pimkName->BindToStorage(pibc, NULL, IID_IStream, (void **) &spIStream)))
{
return E_FAIL;
}
return Load(spIStream);
}
HRESULT STDMETHODCALLTYPE CXMLDocument::Save(/* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pbc, /* [in] */ BOOL fRemember)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::SaveCompleted(/* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pibc)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::GetCurMoniker(/* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppimkName)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
// IXMLError implementation
HRESULT STDMETHODCALLTYPE CXMLDocument::GetErrorInfo(XML_ERROR __RPC_FAR *pErrorReturn)
{
return E_NOTIMPL;
}
/////////////////////////////////////////////////////////////////////////////
// IXMLDocument implementation
HRESULT STDMETHODCALLTYPE CXMLDocument::get_root(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *p)
{
if (p == NULL)
{
return E_INVALIDARG;
}
*p = NULL;
if (m_spRoot)
{
m_spRoot->QueryInterface(IID_IXMLElement, (void **) p);
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_fileSize(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_fileModifiedDate(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_fileUpdatedDate(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_URL(/* [out][retval] */ BSTR __RPC_FAR *p)
{
if (p == NULL)
{
return E_INVALIDARG;
}
USES_CONVERSION;
*p = SysAllocString(A2OLE(m_szURL.c_str()));
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::put_URL(/* [in] */ BSTR p)
{
if (p == NULL)
{
return E_INVALIDARG;
}
USES_CONVERSION;
m_szURL = OLE2A(p);
// Destroy old document
CComQIPtr<IMoniker, &IID_IMoniker> spIMoniker;
if (FAILED(CreateURLMoniker(NULL, A2W(m_szURL.c_str()), &spIMoniker)))
{
return E_FAIL;
}
CComQIPtr<IBindCtx, &IID_IBindCtx> spIBindCtx;
if (FAILED(CreateBindCtx(0, &spIBindCtx)))
{
return E_FAIL;
}
if (FAILED(Load(TRUE, spIMoniker, spIBindCtx, 0)))
{
return E_FAIL;
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_mimeType(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_readyState(/* [out][retval] */ long __RPC_FAR *pl)
{
if (pl == NULL)
{
return E_INVALIDARG;
}
*pl = m_nReadyState;
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_charset(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::put_charset(/* [in] */ BSTR p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_version(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_doctype(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::get_dtdURL(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLDocument::createElement(/* [in] */ VARIANT vType, /* [in][optional] */ VARIANT var1, /* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppElem)
{
if (vType.vt != VT_I4)
{
return E_INVALIDARG;
}
if (ppElem == NULL)
{
return E_INVALIDARG;
}
CXMLElementInstance *pInstance = NULL;
CXMLElementInstance::CreateInstance(&pInstance);
if (pInstance == NULL)
{
return E_OUTOFMEMORY;
}
IXMLElement *pElement = NULL;
if (FAILED(pInstance->QueryInterface(IID_IXMLElement, (void **) &pElement)))
{
pInstance->Release();
return E_NOINTERFACE;
}
// Set the element type
long nType = vType.intVal;
pInstance->PutType(nType);
// Set the tag name
if (var1.vt == VT_BSTR)
{
pInstance->put_tagName(var1.bstrVal);
}
*ppElem = pElement;
return S_OK;
}

View File

@ -0,0 +1,80 @@
// XMLDocument.h : Declaration of the CXMLDocument
#ifndef __XMLDOCUMENT_H_
#define __XMLDOCUMENT_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CXMLDocument
class ATL_NO_VTABLE CXMLDocument :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CXMLDocument, &CLSID_MozXMLDocument>,
public ISupportErrorInfo,
public IDispatchImpl<IXMLDocument, &IID_IXMLDocument, &LIBID_MozActiveXMLLib>,
public IPersistMoniker,
public IPersistStreamInit
{
public:
CXMLDocument();
virtual ~CXMLDocument();
DECLARE_REGISTRY_RESOURCEID(IDR_XMLDOCUMENT)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CXMLDocument)
COM_INTERFACE_ENTRY(IXMLDocument)
COM_INTERFACE_ENTRY(IDispatch)
COM_INTERFACE_ENTRY(IPersistMoniker)
COM_INTERFACE_ENTRY(IPersistStreamInit)
// COM_INTERFACE_ENTRY(ISupportErrorInfo)
END_COM_MAP()
LONG m_nReadyState;
std::string m_szURL;
CComQIPtr<IXMLElement, &IID_IXMLElement> m_spRoot;
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
// IPersistStreamInit
//virtual HRESULT STDMETHODCALLTYPE IsDirty(void);
HRESULT STDMETHODCALLTYPE Load(/* [in] */ LPSTREAM pStm);
HRESULT STDMETHODCALLTYPE Save(/* [in] */ LPSTREAM pStm, /* [in] */ BOOL fClearDirty);
HRESULT STDMETHODCALLTYPE GetSizeMax(/* [out] */ ULARGE_INTEGER __RPC_FAR *pCbSize);
HRESULT STDMETHODCALLTYPE InitNew(void);
// IPersistMoniker
HRESULT STDMETHODCALLTYPE GetClassID(/* [out] */ CLSID __RPC_FAR *pClassID);
HRESULT STDMETHODCALLTYPE IsDirty(void);
HRESULT STDMETHODCALLTYPE Load(/* [in] */ BOOL fFullyAvailable, /* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pibc, /* [in] */ DWORD grfMode);
HRESULT STDMETHODCALLTYPE Save(/* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pbc, /* [in] */ BOOL fRemember);
HRESULT STDMETHODCALLTYPE SaveCompleted(/* [in] */ IMoniker __RPC_FAR *pimkName, /* [in] */ LPBC pibc);
HRESULT STDMETHODCALLTYPE GetCurMoniker(/* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppimkName);
// IXMLError
HRESULT STDMETHODCALLTYPE GetErrorInfo(XML_ERROR __RPC_FAR *pErrorReturn);
// IXMLDocument
HRESULT STDMETHODCALLTYPE get_root(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *p);
HRESULT STDMETHODCALLTYPE get_fileSize(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE get_fileModifiedDate(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE get_fileUpdatedDate(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE get_URL(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE put_URL(/* [in] */ BSTR p);
HRESULT STDMETHODCALLTYPE get_mimeType(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE get_readyState(/* [out][retval] */ long __RPC_FAR *pl);
HRESULT STDMETHODCALLTYPE get_charset(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE put_charset(/* [in] */ BSTR p);
HRESULT STDMETHODCALLTYPE get_version(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE get_doctype(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE get_dtdURL(/* [out][retval] */ BSTR __RPC_FAR *p);
HRESULT STDMETHODCALLTYPE createElement(/* [in] */ VARIANT vType, /* [in][optional] */ VARIANT var1, /* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppElem);
public:
};
typedef CComObject<CXMLDocument> CXMLDocumentInstance;
#endif //__XMLDOCUMENT_H_

View File

@ -0,0 +1,26 @@
HKCR
{
Mozilla.XMLDocument.1 = s 'Mozilla XMLDocument Class'
{
CLSID = s '{45E5B41D-2805-11D3-9425-000000000000}'
}
Mozilla.XMLDocument = s 'Mozilla XMLDocument Class'
{
CLSID = s '{45E5B41D-2805-11D3-9425-000000000000}'
CurVer = s 'Mozilla.XMLDocument.1'
}
NoRemove CLSID
{
ForceRemove {45E5B41D-2805-11D3-9425-000000000000} = s 'Mozilla XMLDocument Class'
{
ProgID = s 'Mozilla.XMLDocument.1'
VersionIndependentProgID = s 'Mozilla.XMLDocument'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{45E5B410-2805-11D3-9425-000000000000}'
}
}
}

View File

@ -0,0 +1,226 @@
// XMLElement.cpp : Implementation of CXMLElement
#include "stdafx.h"
//#include "Activexml.h"
#include "XMLElement.h"
CXMLElement::CXMLElement()
{
m_nType = 0;
m_pParent = NULL;
}
CXMLElement::~CXMLElement()
{
}
HRESULT CXMLElement::SetParent(IXMLElement *pParent)
{
// Note: parent is not refcounted
m_pParent = pParent;
return S_OK;
}
HRESULT CXMLElement::PutType(long nType)
{
m_nType = nType;
return S_OK;
}
HRESULT CXMLElement::ReleaseAll()
{
// Release all children
m_cChildren.clear();
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
// CXMLElement
// Return the element's tag name
HRESULT STDMETHODCALLTYPE CXMLElement::get_tagName(/* [out][retval] */ BSTR __RPC_FAR *p)
{
if (p == NULL)
{
return E_INVALIDARG;
}
USES_CONVERSION;
*p = SysAllocString(A2OLE(m_szTagName.c_str()));
return S_OK;
}
// Store the tag name
HRESULT STDMETHODCALLTYPE CXMLElement::put_tagName(/* [in] */ BSTR p)
{
if (p == NULL)
{
return E_INVALIDARG;
}
USES_CONVERSION;
m_szTagName = OLE2A(p);
return S_OK;
}
// Returns the parent element
HRESULT STDMETHODCALLTYPE CXMLElement::get_parent(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppParent)
{
if (ppParent == NULL)
{
return E_INVALIDARG;
}
*ppParent = NULL;
if (m_pParent)
{
return m_pParent->QueryInterface(IID_IXMLElement, (void **) ppParent);
}
return S_OK;
}
// Set the specified attribute value
HRESULT STDMETHODCALLTYPE CXMLElement::setAttribute(/* [in] */ BSTR strPropertyName, /* [in] */ VARIANT PropertyValue)
{
if (strPropertyName == NULL || PropertyValue.vt != VT_BSTR)
{
return E_INVALIDARG;
}
USES_CONVERSION;
std::string szPropertyName = OLE2A(strPropertyName);
std::string szPropertyValue = OLE2A(PropertyValue.bstrVal);
m_cAttributes[szPropertyName] = szPropertyValue;
return S_OK;
}
// Return the requested attribute
HRESULT STDMETHODCALLTYPE CXMLElement::getAttribute(/* [in] */ BSTR strPropertyName, /* [out][retval] */ VARIANT __RPC_FAR *PropertyValue)
{
if (strPropertyName == NULL || PropertyValue == NULL)
{
return E_INVALIDARG;
}
USES_CONVERSION;
std::string szPropertyName = OLE2A(strPropertyName);
StringMap::iterator i = m_cAttributes.find(szPropertyName);
if (i == m_cAttributes.end())
{
return S_FALSE;
}
PropertyValue->vt = VT_BSTR;
PropertyValue->bstrVal = SysAllocString(A2OLE((*i).second.c_str()));
return S_OK;
}
// Find and remove the specified attribute
HRESULT STDMETHODCALLTYPE CXMLElement::removeAttribute(/* [in] */ BSTR strPropertyName)
{
if (strPropertyName == NULL)
{
return E_INVALIDARG;
}
USES_CONVERSION;
std::string szPropertyName = OLE2A(strPropertyName);
StringMap::iterator i = m_cAttributes.find(szPropertyName);
if (i == m_cAttributes.end())
{
return E_INVALIDARG;
}
m_cAttributes.erase(i);
return S_OK;
}
// Return the child collection for this element
HRESULT STDMETHODCALLTYPE CXMLElement::get_children(/* [out][retval] */ IXMLElementCollection __RPC_FAR *__RPC_FAR *pp)
{
CXMLElementCollectionInstance *pCollection = NULL;
CXMLElementCollectionInstance::CreateInstance(&pCollection);
if (pCollection == NULL)
{
return E_OUTOFMEMORY;
}
// Add children to the collection
for (ElementList::iterator i = m_cChildren.begin(); i != m_cChildren.end(); i++)
{
pCollection->Add(*i);
}
pCollection->QueryInterface(IID_IXMLElementCollection, (void **) pp);
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLElement::get_type(/* [out][retval] */ long __RPC_FAR *plType)
{
if (plType == NULL)
{
return E_INVALIDARG;
}
*plType = m_nType;
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLElement::get_text(/* [out][retval] */ BSTR __RPC_FAR *p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLElement::put_text(/* [in] */ BSTR p)
{
return E_NOTIMPL;
}
HRESULT STDMETHODCALLTYPE CXMLElement::addChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem, long lIndex, long lReserved)
{
if (pChildElem == NULL)
{
return E_INVALIDARG;
}
// Set the child's parent to be this element
((CXMLElement *) pChildElem)->SetParent(this);
if (lIndex < 0 || lIndex >= m_cChildren.size())
{
// Append to end
m_cChildren.push_back(pChildElem);
}
else
{
// TODO m_cChildren.insert(&m_cChildren[lIndex]);
m_cChildren.push_back(pChildElem);
}
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLElement::removeChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem)
{
// TODO
return E_NOTIMPL;
}

View File

@ -0,0 +1,71 @@
// XMLElement.h : Declaration of the CXMLElement
#ifndef __XMLELEMENT_H_
#define __XMLELEMENT_H_
#include "resource.h" // main symbols
#include <vector>
#include <string>
#include <map>
typedef std::map<std::string, std::string> StringMap;
typedef std::vector< CComQIPtr<IXMLElement, &IID_IXMLElement> > ElementList;
/////////////////////////////////////////////////////////////////////////////
// CXMLElement
class ATL_NO_VTABLE CXMLElement :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CXMLElement, &CLSID_MozXMLElement>,
public IDispatchImpl<IXMLElement, &IID_IXMLElement, &LIBID_MozActiveXMLLib>
{
// Pointer to parent
IXMLElement *m_pParent;
// List of children
ElementList m_cChildren;
// Tag name
std::string m_szTagName;
// Text
std::string m_szText;
// Type
long m_nType;
// Attribute list
StringMap m_cAttributes;
public:
CXMLElement();
virtual ~CXMLElement();
virtual HRESULT SetParent(IXMLElement *pParent);
virtual HRESULT PutType(long nType);
virtual HRESULT ReleaseAll();
DECLARE_REGISTRY_RESOURCEID(IDR_XMLELEMENT)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CXMLElement)
COM_INTERFACE_ENTRY(IXMLElement)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// IXMLElement
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_tagName(/* [out][retval] */ BSTR __RPC_FAR *p);
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_tagName(/* [in] */ BSTR p);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_parent(/* [out][retval] */ IXMLElement __RPC_FAR *__RPC_FAR *ppParent);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE setAttribute(/* [in] */ BSTR strPropertyName, /* [in] */ VARIANT PropertyValue);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE getAttribute(/* [in] */ BSTR strPropertyName, /* [out][retval] */ VARIANT __RPC_FAR *PropertyValue);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeAttribute(/* [in] */ BSTR strPropertyName);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_children(/* [out][retval] */ IXMLElementCollection __RPC_FAR *__RPC_FAR *pp);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_type(/* [out][retval] */ long __RPC_FAR *plType);
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_text(/* [out][retval] */ BSTR __RPC_FAR *p);
virtual /* [id][propput] */ HRESULT STDMETHODCALLTYPE put_text(/* [in] */ BSTR p);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE addChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem, long lIndex, long lReserved);
virtual /* [id] */ HRESULT STDMETHODCALLTYPE removeChild(/* [in] */ IXMLElement __RPC_FAR *pChildElem);
public:
};
typedef CComObject<CXMLElement> CXMLElementInstance;
#endif //__XMLELEMENT_H_

View File

@ -0,0 +1,26 @@
HKCR
{
Mozilla.XMLElement.1 = s 'MozillaXMLElement Class'
{
CLSID = s '{45E5B420-2805-11D3-9425-000000000000}'
}
Mozilla..MLElement = s 'MozillaXMLElement Class'
{
CLSID = s '{45E5B420-2805-11D3-9425-000000000000}'
CurVer = s 'Mozilla.XMLElement.1'
}
NoRemove CLSID
{
ForceRemove {45E5B420-2805-11D3-9425-000000000000} = s 'Mozilla XMLElement Class'
{
ProgID = s 'Mozilla.XMLElement.1'
VersionIndependentProgID = s 'Mozilla.XMLElement'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{45E5B410-2805-11D3-9425-000000000000}'
}
}
}

View File

@ -0,0 +1,164 @@
// XMLElementCollection.cpp : Implementation of CXMLElementCollection
#include "stdafx.h"
//#include "Activexml.h"
#include "XMLElementCollection.h"
CXMLElementCollection::CXMLElementCollection()
{
}
CXMLElementCollection::~CXMLElementCollection()
{
}
HRESULT CXMLElementCollection::Add(IXMLElement *pElement)
{
if (pElement == NULL)
{
return E_INVALIDARG;
}
m_cElements.push_back( CComQIPtr<IXMLElement, &IID_IXMLElement>(pElement));
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
// CXMLElementCollection
HRESULT STDMETHODCALLTYPE CXMLElementCollection::put_length(/* [in] */ long v)
{
// Why does MS define a method that has no purpose?
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLElementCollection::get_length(/* [out][retval] */ long __RPC_FAR *p)
{
if (p == NULL)
{
return E_INVALIDARG;
}
*p = m_cElements.size();
return S_OK;
}
HRESULT STDMETHODCALLTYPE CXMLElementCollection::get__newEnum(/* [out][retval] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk)
{
return E_NOTIMPL;
}
// Perhaps the most overly complicated method ever...
HRESULT STDMETHODCALLTYPE CXMLElementCollection::item(/* [in][optional] */ VARIANT var1, /* [in][optional] */ VARIANT var2, /* [out][retval] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp)
{
if (ppDisp == NULL)
{
return E_INVALIDARG;
}
*ppDisp;
CComVariant vIndex;
// If var1 is a number, the caller wants the element at the specified index
if (vIndex.ChangeType(VT_I4, &var1) == S_OK)
{
long nIndex = vIndex.intVal;
if (nIndex < 0 || nIndex >= m_cElements.size())
{
return E_INVALIDARG;
}
// Get the element at the specified index
m_cElements[nIndex]->QueryInterface(IID_IDispatch, (void **) ppDisp);
return S_OK;
}
// If var1 is a string, the caller wants a collection of all elements with
// the matching tagname, unless var2 contains an index or if there is only
// one in which case just the element is returned.
CComVariant vName;
if (FAILED(vName.ChangeType(VT_BSTR, &var1)))
{
return E_INVALIDARG;
}
// Compile a list of elements matching the name
ElementList cElements;
ElementList::iterator i;
for (i = m_cElements.begin(); i != m_cElements.end(); i++)
{
CComQIPtr<IXMLElement, &IID_IXMLElement> spElement;
BSTR bstrTagName = NULL;
(*i)->get_tagName(&bstrTagName);
if (bstrTagName)
{
if (wcscmp(bstrTagName, vName.bstrVal) == 0)
{
cElements.push_back(*i);
}
SysFreeString(bstrTagName);
}
}
// Are there any matching elements?
if (cElements.empty())
{
return S_OK;
}
// Does var2 contain an index?
if (var2.vt == VT_I4)
{
long nIndex = var2.vt;
if (nIndex < 0 || nIndex >= cElements.size())
{
return E_INVALIDARG;
}
// Get the element at the specified index
cElements[nIndex]->QueryInterface(IID_IDispatch, (void **) ppDisp);
return S_OK;
}
// Is there more than one element?
if (cElements.size() > 1)
{
// Create another collection
CXMLElementCollectionInstance *pCollection = NULL;
CXMLElementCollectionInstance::CreateInstance(&pCollection);
if (pCollection == NULL)
{
return E_OUTOFMEMORY;
}
if (FAILED(pCollection->QueryInterface(IID_IDispatch, (void **) ppDisp)))
{
pCollection->Release();
return E_FAIL;
}
// Add elements to the collection
for (i = cElements.begin(); i != cElements.end(); i++)
{
pCollection->Add(*i);
}
return S_OK;
}
// Return the pointer to the element
if (FAILED(cElements[0]->QueryInterface(IID_IDispatch, (void **) ppDisp)))
{
return E_FAIL;
}
return S_OK;
}

View File

@ -0,0 +1,43 @@
// XMLElementCollection.h : Declaration of the CXMLElementCollection
#ifndef __XMLELEMENTCOLLECTION_H_
#define __XMLELEMENTCOLLECTION_H_
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CXMLElementCollection
class ATL_NO_VTABLE CXMLElementCollection :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CXMLElementCollection, &CLSID_MozXMLElementCollection>,
public IDispatchImpl<IXMLElementCollection, &IID_IXMLElementCollection, &LIBID_MozActiveXMLLib>
{
// List of elements
ElementList m_cElements;
public:
CXMLElementCollection();
virtual ~CXMLElementCollection();
DECLARE_REGISTRY_RESOURCEID(IDR_XMLELEMENTCOLLECTION)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CXMLElementCollection)
COM_INTERFACE_ENTRY(IXMLElementCollection)
COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()
// IXMLElementCollection
virtual HRESULT STDMETHODCALLTYPE put_length(/* [in] */ long v);
virtual HRESULT STDMETHODCALLTYPE get_length(/* [out][retval] */ long __RPC_FAR *p);
virtual HRESULT STDMETHODCALLTYPE get__newEnum(/* [out][retval] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
virtual HRESULT STDMETHODCALLTYPE item(/* [in][optional] */ VARIANT var1, /* [in][optional] */ VARIANT var2, /* [out][retval] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp);
public:
HRESULT Add(IXMLElement *pElement);
};
typedef CComObject<CXMLElementCollection> CXMLElementCollectionInstance;
#endif //__XMLELEMENTCOLLECTION_H_

View File

@ -0,0 +1,26 @@
HKCR
{
Mozilla.XMLElementCollection.1 = s 'Mozilla XMLElementCollection Class'
{
CLSID = s '{45E5B422-2805-11D3-9425-000000000000}'
}
Mozilla.XMLElementCollection = s 'Mozilla XMLElementCollection Class'
{
CLSID = s '{45E5B422-2805-11D3-9425-000000000000}'
CurVer = s 'Mozilla.XMLElementCollection.1'
}
NoRemove CLSID
{
ForceRemove {45E5B422-2805-11D3-9425-000000000000} = s 'Mozilla XMLElementCollection Class'
{
ProgID = s 'Mozilla.XMLElementCollection.1'
VersionIndependentProgID = s 'Mozilla.XMLElementCollection'
ForceRemove 'Programmable'
InprocServer32 = s '%MODULE%'
{
val ThreadingModel = s 'Apartment'
}
'TypeLib' = s '{45E5B410-2805-11D3-9425-000000000000}'
}
}
}

View File

@ -0,0 +1,76 @@
// activexml.cpp : Implementation of DLL Exports.
// Note: Proxy/Stub Information
// To build a separate proxy/stub DLL,
// run nmake -f activexmlps.mk in the project directory.
#include "stdafx.h"
#include "resource.h"
//#include <initguid.h>
//#include "activexml.h"
#include "activexml_i.c"
#include "XMLDocument.h"
#include "XMLElement.h"
#include "XMLElementCollection.h"
CComModule _Module;
BEGIN_OBJECT_MAP(ObjectMap)
OBJECT_ENTRY(CLSID_MozXMLDocument, CXMLDocument)
//OBJECT_ENTRY(CLSID_MozXMLElement, CXMLElement)
//OBJECT_ENTRY(CLSID_MozXMLElementCollection, CXMLElementCollection)
END_OBJECT_MAP()
/////////////////////////////////////////////////////////////////////////////
// DLL Entry Point
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
_Module.Init(ObjectMap, hInstance, &LIBID_MozActiveXMLLib);
DisableThreadLibraryCalls(hInstance);
}
else if (dwReason == DLL_PROCESS_DETACH)
_Module.Term();
return TRUE; // ok
}
/////////////////////////////////////////////////////////////////////////////
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
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)
{
return _Module.GetClassObject(rclsid, riid, ppv);
}
/////////////////////////////////////////////////////////////////////////////
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
return _Module.RegisterServer(TRUE);
}
/////////////////////////////////////////////////////////////////////////////
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
return _Module.UnregisterServer(TRUE);
}

View File

@ -0,0 +1,9 @@
; activexml.def : Declares the module parameters.
LIBRARY "activexml.DLL"
EXPORTS
DllCanUnloadNow @1 PRIVATE
DllGetClassObject @2 PRIVATE
DllRegisterServer @3 PRIVATE
DllUnregisterServer @4 PRIVATE

View File

@ -0,0 +1,360 @@
# Microsoft Developer Studio Project File - Name="activexml" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=activexml - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "activexml.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "activexml.mak" CFG="activexml - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "activexml - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "activexml - Win32 Unicode Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "activexml - Win32 Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "activexml - Win32 Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "activexml - Win32 Unicode Release MinSize" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "activexml - Win32 Unicode Release MinDependency" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "activexml - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "M:\moz\mozilla\dist\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /Yu"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib Urlmon.lib M:\moz\mozilla\dist\WIN32_D.OBJ\lib\expat.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# Begin Custom Build - Performing registration
OutDir=.\Debug
TargetPath=.\Debug\activexml.dll
InputPath=.\Debug\activexml.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "activexml - Win32 Unicode Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "DebugU"
# PROP BASE Intermediate_Dir "DebugU"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "DebugU"
# PROP Intermediate_Dir "DebugU"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# Begin Custom Build - Performing registration
OutDir=.\DebugU
TargetPath=.\DebugU\activexml.dll
InputPath=.\DebugU\activexml.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
# End Custom Build
!ELSEIF "$(CFG)" == "activexml - Win32 Release MinSize"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseMinSize"
# PROP BASE Intermediate_Dir "ReleaseMinSize"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseMinSize"
# PROP Intermediate_Dir "ReleaseMinSize"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\ReleaseMinSize
TargetPath=.\ReleaseMinSize\activexml.dll
InputPath=.\ReleaseMinSize\activexml.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "activexml - Win32 Release MinDependency"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseMinDependency"
# PROP BASE Intermediate_Dir "ReleaseMinDependency"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseMinDependency"
# PROP Intermediate_Dir "ReleaseMinDependency"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\ReleaseMinDependency
TargetPath=.\ReleaseMinDependency\activexml.dll
InputPath=.\ReleaseMinDependency\activexml.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
# End Custom Build
!ELSEIF "$(CFG)" == "activexml - Win32 Unicode Release MinSize"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseUMinSize"
# PROP BASE Intermediate_Dir "ReleaseUMinSize"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseUMinSize"
# PROP Intermediate_Dir "ReleaseUMinSize"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\ReleaseUMinSize
TargetPath=.\ReleaseUMinSize\activexml.dll
InputPath=.\ReleaseUMinSize\activexml.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
# End Custom Build
!ELSEIF "$(CFG)" == "activexml - Win32 Unicode Release MinDependency"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "ReleaseUMinDependency"
# PROP BASE Intermediate_Dir "ReleaseUMinDependency"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "ReleaseUMinDependency"
# PROP Intermediate_Dir "ReleaseUMinDependency"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" /D "_UNICODE" /D "_ATL_STATIC_REGISTRY" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# Begin Custom Build - Performing registration
OutDir=.\ReleaseUMinDependency
TargetPath=.\ReleaseUMinDependency\activexml.dll
InputPath=.\ReleaseUMinDependency\activexml.dll
SOURCE="$(InputPath)"
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
if "%OS%"=="" goto NOTNT
if not "%OS%"=="Windows_NT" goto NOTNT
regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
goto end
:NOTNT
echo Warning : Cannot register Unicode DLL on Windows 95
:end
# End Custom Build
!ENDIF
# Begin Target
# Name "activexml - Win32 Debug"
# Name "activexml - Win32 Unicode Debug"
# Name "activexml - Win32 Release MinSize"
# Name "activexml - Win32 Release MinDependency"
# Name "activexml - Win32 Unicode Release MinSize"
# Name "activexml - Win32 Unicode Release MinDependency"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\activexml.cpp
# End Source File
# Begin Source File
SOURCE=.\activexml.def
# End Source File
# Begin Source File
SOURCE=.\activexml.idl
# ADD MTL /tlb ".\activexml.tlb" /h "activexml.h" /iid "activexml_i.c" /Oicf
# End Source File
# Begin Source File
SOURCE=.\activexml.rc
# End Source File
# Begin Source File
SOURCE=.\ParseExpat.cpp
# End Source File
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# Begin Source File
SOURCE=.\XMLDocument.cpp
# End Source File
# Begin Source File
SOURCE=.\XMLElement.cpp
# End Source File
# Begin Source File
SOURCE=.\XMLElementCollection.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Resource.h
# End Source File
# Begin Source File
SOURCE=.\StdAfx.h
# End Source File
# Begin Source File
SOURCE=.\XMLDocument.h
# End Source File
# Begin Source File
SOURCE=.\XMLElement.h
# End Source File
# Begin Source File
SOURCE=.\XMLElementCollection.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# Begin Source File
SOURCE=.\XMLDocument.rgs
# End Source File
# Begin Source File
SOURCE=.\XMLElement.rgs
# End Source File
# Begin Source File
SOURCE=.\XMLElementCollection.rgs
# End Source File
# End Group
# Begin Group "Expat"
# PROP Default_Filter ""
# Begin Source File
SOURCE=..\..\..\..\expat\xmlparse\xmlparse.h
# End Source File
# End Group
# End Target
# End Project

View File

@ -0,0 +1,143 @@
// activexml.idl : IDL source for activexml.dll
//
// This file will be processed by the MIDL tool to
// produce the type library (activexml.tlb) and marshalling code.
#include "msxmldid.h"
//import "oaidl.idl";
//import "ocidl.idl";
[
uuid(45E5B410-2805-11D3-9425-000000000000),
version(1.0),
helpstring("Mozilla XML 1.0 Type Library")
]
library MozActiveXMLLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
typedef enum mozxmlelemTYPE {
XMLELEMTYPE_ELEMENT,
XMLELEMTYPE_TEXT,
XMLELEMTYPE_COMMENT,
XMLELEMTYPE_DOCUMENT,
XMLELEMTYPE_DTD,
XMLELEMTYPE_PI,
XMLELEMTYPE_OTHER
} XMLELEM_TYPE;
interface IXMLElement;
[
object,
local,
uuid(65725580-9B5D-11d0-9BFE-00C04FC99C8E) // IID_IXMLElementCollection
]
interface IXMLElementCollection : IDispatch
{
[propput, id(DISPID_XMLELEMENTCOLLECTION_LENGTH)] HRESULT length([in] long v);
[propget, id(DISPID_XMLELEMENTCOLLECTION_LENGTH)] HRESULT length([retval, out] long * p);
[propget, restricted, hidden, id(DISPID_XMLELEMENTCOLLECTION_NEWENUM)] HRESULT _newEnum([retval, out] IUnknown ** ppUnk);
[id(DISPID_XMLELEMENTCOLLECTION_ITEM)] HRESULT item([optional, in] VARIANT var1,[optional, in] VARIANT var2,[retval, out] IDispatch ** ppDisp);
};
[
object,
local,
uuid(F52E2B61-18A1-11d1-B105-00805F49916B) // IID_IXMLDocument
]
interface IXMLDocument : IDispatch
{
[propget, id(DISPID_XMLDOCUMENT_ROOT)] HRESULT root ([retval, out] IXMLElement * * p);
[propget, id(DISPID_XMLDOCUMENT_FILESIZE)] HRESULT fileSize([retval, out] BSTR * p);
[propget, id(DISPID_XMLDOCUMENT_FILEMODIFIEDDATE)] HRESULT fileModifiedDate([retval, out] BSTR * p);
[propget, id(DISPID_XMLDOCUMENT_FILEUPDATEDDATE)] HRESULT fileUpdatedDate([retval, out] BSTR * p);
[propget, id(DISPID_XMLDOCUMENT_URL)] HRESULT URL([retval, out] BSTR * p);
[propput, id(DISPID_XMLDOCUMENT_URL)] HRESULT URL([in] BSTR p);
[propget, id(DISPID_XMLDOCUMENT_MIMETYPE)] HRESULT mimeType([retval, out] BSTR * p);
[propget, id(DISPID_XMLDOCUMENT_READYSTATE)] HRESULT readyState([retval, out]long *pl);
[propget, id(DISPID_XMLDOCUMENT_CHARSET)] HRESULT charset([retval, out]BSTR *p);
[propput, id(DISPID_XMLDOCUMENT_CHARSET)] HRESULT charset([in]BSTR p);
[propget, id(DISPID_XMLDOCUMENT_VERSION)] HRESULT version([retval, out]BSTR *p);
[propget, id(DISPID_XMLDOCUMENT_DOCTYPE)] HRESULT doctype([retval, out]BSTR *p);
[propget, id(DISPID_XMLDOCUMENT_DTDURL)] HRESULT dtdURL([retval, out]BSTR *p);
[id(DISPID_XMLDOCUMENT_CREATEELEMENT)] HRESULT createElement([in] VARIANT vType, [optional, in] VARIANT var1, [retval, out] IXMLElement * * ppElem);
};
[
object,
local,
uuid(3F7F31AC-E15F-11d0-9C25-00C04FC99C8E) // IID_IXMLElement
]
interface IXMLElement : IDispatch
{
[propget, id(DISPID_XMLELEMENT_TAGNAME)] HRESULT tagName([retval, out] BSTR * p);
[propput, id(DISPID_XMLELEMENT_TAGNAME)] HRESULT tagName([in] BSTR p);
[propget, id(DISPID_XMLELEMENT_PARENT)] HRESULT parent([retval, out]IXMLElement **ppParent);
[id(DISPID_XMLELEMENT_SETATTRIBUTE)] HRESULT setAttribute([in] BSTR strPropertyName,[in] VARIANT PropertyValue);
[id(DISPID_XMLELEMENT_GETATTRIBUTE)] HRESULT getAttribute([in] BSTR strPropertyName,[retval, out] VARIANT* PropertyValue);
[id(DISPID_XMLELEMENT_REMOVEATTRIBUTE)] HRESULT removeAttribute([in] BSTR strPropertyName);
[propget, id(DISPID_XMLELEMENT_CHILDREN)] HRESULT children([retval, out] IXMLElementCollection * * pp);
[propget, id(DISPID_XMLELEMENT_TYPE)] HRESULT type([retval, out] long *plType);
[propget, id(DISPID_XMLELEMENT_TEXT)] HRESULT text([retval, out] BSTR *p);
[propput, id(DISPID_XMLELEMENT_TEXT)] HRESULT text([in] BSTR p);
[id(DISPID_XMLELEMENT_ADDCHILD)] HRESULT addChild([in] IXMLElement *pChildElem, long lIndex, long lReserved); // lReserved must be -1
[id(DISPID_XMLELEMENT_REMOVECHILD)] HRESULT removeChild([in]IXMLElement *pChildElem);
}
typedef struct __xml_error {
unsigned _nLine; // line number
BSTR _pchBuf; // current input buffer
unsigned _cchBuf; // number of chars in buffer
unsigned _ich; // index of the char when error occurred
BSTR _pszFound; // token found
BSTR _pszExpected; // token expected
DWORD _reserved1; // reserved
DWORD _reserved2; // reserved
} XML_ERROR;
[
object,
local,
uuid(948C5AD3-C58D-11d0-9C0B-00C04FC99C8E) // IID_IXMLError
]
interface IXMLError : IUnknown
{
HRESULT GetErrorInfo(XML_ERROR *pErrorReturn);
}
[
uuid(45E5B41D-2805-11D3-9425-000000000000),
helpstring("MozXMLDocument Class")
]
coclass MozXMLDocument
{
interface IDispatch;
[default] interface IXMLDocument;
};
[
uuid(45E5B420-2805-11D3-9425-000000000000),
helpstring("MozXMLElement Class")
]
coclass MozXMLElement
{
interface IDispatch;
[default] interface IXMLElement;
};
[
uuid(45E5B422-2805-11D3-9425-000000000000),
helpstring("MozXMLElementCollection Class")
]
coclass MozXMLElementCollection
{
interface IDispatch;
[default] interface IXMLElementCollection;
};
};

View File

@ -0,0 +1,142 @@
//Microsoft Developer Studio 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 DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"1 TYPELIB ""activexml.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "\0"
VALUE "CompanyName", "\0"
VALUE "FileDescription", "Mozilla XML Module\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "activexml\0"
VALUE "LegalCopyright", "Copyright 1999\0"
VALUE "LegalTrademarks", "\0"
VALUE "OLESelfRegister", "\0"
VALUE "OriginalFilename", "activexml.DLL\0"
VALUE "PrivateBuild", "\0"
VALUE "ProductName", "activexml Module\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
VALUE "SpecialBuild", "\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE DISCARDABLE
BEGIN
IDS_PROJNAME "activexml"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_XMLDOCUMENT REGISTRY DISCARDABLE "XMLDocument.rgs"
IDR_XMLELEMENT REGISTRY DISCARDABLE "XMLElement.rgs"
IDR_XMLELEMENTCOLLECTION REGISTRY DISCARDABLE "XMLElementCollection.rgs"
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "activexml.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -0,0 +1,11 @@
LIBRARY "activexmlPS"
DESCRIPTION 'Proxy/Stub DLL'
EXPORTS
DllGetClassObject @1 PRIVATE
DllCanUnloadNow @2 PRIVATE
GetProxyDllInfo @3 PRIVATE
DllRegisterServer @4 PRIVATE
DllUnregisterServer @5 PRIVATE

View File

@ -0,0 +1,19 @@
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by activexml.rc
//
#define IDS_PROJNAME 100
#define IDR_XMLDOCUMENT 101
#define IDR_XMLELEMENT 102
#define IDR_XMLELEMENTCOLLECTION 103
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif