2005-08-02 13:29:04 +02:00
|
|
|
/*
|
|
|
|
* DOM Document implementation
|
|
|
|
*
|
|
|
|
* Copyright 2005 Mike McCormack
|
|
|
|
*
|
2005-11-08 13:46:43 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
2005-08-02 13:29:04 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
2005-11-08 13:46:43 +01:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2005-08-02 13:29:04 +02:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2005-12-01 18:46:42 +01:00
|
|
|
#include <assert.h>
|
2005-08-02 13:29:04 +02:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2005-08-10 11:54:22 +02:00
|
|
|
#include "winnls.h"
|
2005-08-02 13:29:04 +02:00
|
|
|
#include "ole2.h"
|
2005-11-08 20:59:36 +01:00
|
|
|
#include "msxml2.h"
|
2005-08-02 13:29:04 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "msxml_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
|
|
|
|
|
|
|
|
#ifdef HAVE_LIBXML2
|
|
|
|
|
|
|
|
typedef struct _domdoc
|
|
|
|
{
|
|
|
|
const struct IXMLDOMDocumentVtbl *lpVtbl;
|
|
|
|
LONG ref;
|
|
|
|
VARIANT_BOOL async;
|
2005-12-01 18:46:42 +01:00
|
|
|
IUnknown *node_unk;
|
2005-08-10 11:54:22 +02:00
|
|
|
IXMLDOMNode *node;
|
2005-08-02 13:29:04 +02:00
|
|
|
} domdoc;
|
|
|
|
|
2005-11-18 16:05:26 +01:00
|
|
|
LONG xmldoc_add_ref(xmlDocPtr doc)
|
|
|
|
{
|
|
|
|
LONG ref = InterlockedIncrement((LONG*)&doc->_private);
|
|
|
|
TRACE("%ld\n", ref);
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
LONG xmldoc_release(xmlDocPtr doc)
|
|
|
|
{
|
|
|
|
LONG ref = InterlockedDecrement((LONG*)&doc->_private);
|
|
|
|
TRACE("%ld\n", ref);
|
|
|
|
if(ref == 0)
|
|
|
|
{
|
|
|
|
TRACE("freeing docptr %p\n", doc);
|
|
|
|
xmlFreeDoc(doc);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
2005-08-02 13:29:04 +02:00
|
|
|
static inline domdoc *impl_from_IXMLDOMDocument( IXMLDOMDocument *iface )
|
|
|
|
{
|
|
|
|
return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpVtbl));
|
|
|
|
}
|
|
|
|
|
2005-08-18 12:48:13 +02:00
|
|
|
static inline xmlDocPtr get_doc( domdoc *This )
|
|
|
|
{
|
|
|
|
return (xmlDocPtr) xmlNodePtr_from_domnode( This->node, XML_DOCUMENT_NODE );
|
|
|
|
}
|
|
|
|
|
2005-08-02 13:29:04 +02:00
|
|
|
static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument *iface, REFIID riid, void** ppvObject )
|
|
|
|
{
|
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
|
2005-10-31 22:04:31 +01:00
|
|
|
TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
|
2005-08-02 13:29:04 +02:00
|
|
|
|
|
|
|
if ( IsEqualGUID( riid, &IID_IXMLDOMDocument ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IUnknown ) )
|
|
|
|
{
|
|
|
|
*ppvObject = iface;
|
|
|
|
}
|
2005-12-01 18:46:42 +01:00
|
|
|
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
|
|
|
|
IsEqualGUID( riid, &IID_IDispatch ) )
|
|
|
|
{
|
|
|
|
return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
|
|
|
|
}
|
2005-08-02 13:29:04 +02:00
|
|
|
else
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
|
|
|
|
IXMLDOMDocument_AddRef( iface );
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static ULONG WINAPI domdoc_AddRef(
|
|
|
|
IXMLDOMDocument *iface )
|
|
|
|
{
|
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
TRACE("%p\n", This );
|
|
|
|
return InterlockedIncrement( &This->ref );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static ULONG WINAPI domdoc_Release(
|
|
|
|
IXMLDOMDocument *iface )
|
|
|
|
{
|
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
LONG ref;
|
|
|
|
|
|
|
|
TRACE("%p\n", This );
|
|
|
|
|
|
|
|
ref = InterlockedDecrement( &This->ref );
|
|
|
|
if ( ref == 0 )
|
|
|
|
{
|
2005-12-01 18:46:42 +01:00
|
|
|
IUnknown_Release( This->node_unk );
|
2005-08-02 13:29:04 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, This );
|
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_GetTypeInfoCount( IXMLDOMDocument *iface, UINT* pctinfo )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_GetTypeInfo(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_GetIDsOfNames(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
REFIID riid,
|
|
|
|
LPOLESTR* rgszNames,
|
|
|
|
UINT cNames,
|
|
|
|
LCID lcid,
|
|
|
|
DISPID* rgDispId)
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_Invoke(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
DISPID dispIdMember,
|
|
|
|
REFIID riid,
|
|
|
|
LCID lcid,
|
|
|
|
WORD wFlags,
|
|
|
|
DISPPARAMS* pDispParams,
|
|
|
|
VARIANT* pVarResult,
|
|
|
|
EXCEPINFO* pExcepInfo,
|
|
|
|
UINT* puArgErr)
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_nodeName(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR* name )
|
|
|
|
{
|
2005-08-19 13:23:02 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_nodeName( This->node, name );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_nodeValue(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT* value )
|
|
|
|
{
|
2005-08-19 13:23:02 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_nodeValue( This->node, value );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_nodeValue(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT value)
|
|
|
|
{
|
2005-08-19 13:23:02 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_put_nodeValue( This->node, value );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_nodeType(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
DOMNodeType* type )
|
|
|
|
{
|
2005-08-19 13:23:02 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_nodeType( This->node, type );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_parentNode(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode** parent )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_parentNode( This->node, parent );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_childNodes(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNodeList** childList )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_childNodes( This->node, childList );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_firstChild(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode** firstChild )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_firstChild( This->node, firstChild );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_lastChild(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode** lastChild )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_lastChild( This->node, lastChild );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_previousSibling(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode** previousSibling )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_previousSibling( This->node, previousSibling );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_nextSibling(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode** nextSibling )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_nextSibling( This->node, nextSibling );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_attributes(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNamedNodeMap** attributeMap )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_attributes( This->node, attributeMap );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_insertBefore(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode* newChild,
|
|
|
|
VARIANT refChild,
|
|
|
|
IXMLDOMNode** outNewChild )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_insertBefore( This->node, newChild, refChild, outNewChild );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_replaceChild(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode* newChild,
|
|
|
|
IXMLDOMNode* oldChild,
|
|
|
|
IXMLDOMNode** outOldChild)
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_replaceChild( This->node, newChild, oldChild, outOldChild );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_removeChild(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode* childNode,
|
|
|
|
IXMLDOMNode** oldChild)
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_removeChild( This->node, childNode, oldChild );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_appendChild(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode* newChild,
|
|
|
|
IXMLDOMNode** outNewChild)
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_appendChild( This->node, newChild, outNewChild );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_hasChildNodes(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL* hasChild)
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_hasChildNodes( This->node, hasChild );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_ownerDocument(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMDocument** DOMDocument)
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_ownerDocument( This->node, DOMDocument );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_cloneNode(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL deep,
|
|
|
|
IXMLDOMNode** cloneRoot)
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_cloneNode( This->node, deep, cloneRoot );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_nodeTypeString(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR* nodeType )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_nodeTypeString( This->node, nodeType );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_text(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR* text )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_text( This->node, text );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_text(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR text )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_put_text( This->node, text );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_specified(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL* isSpecified )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_specified( This->node, isSpecified );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_definition(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode** definitionNode )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_definition( This->node, definitionNode );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_nodeTypedValue(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT* typedValue )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_nodeTypedValue( This->node, typedValue );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_nodeTypedValue(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT typedValue )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_put_nodeTypedValue( This->node, typedValue );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_dataType(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT* dataTypeName )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_dataType( This->node, dataTypeName );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_dataType(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR dataTypeName )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_put_dataType( This->node, dataTypeName );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_xml(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR* xmlString )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_xml( This->node, xmlString );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_transformNode(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode* styleSheet,
|
|
|
|
BSTR* xmlString )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_transformNode( This->node, styleSheet, xmlString );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_selectNodes(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR queryString,
|
|
|
|
IXMLDOMNodeList** resultList )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_selectNodes( This->node, queryString, resultList );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_selectSingleNode(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR queryString,
|
|
|
|
IXMLDOMNode** resultNode )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_selectSingleNode( This->node, queryString, resultNode );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_parsed(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL* isParsed )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_parsed( This->node, isParsed );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_namespaceURI(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR* namespaceURI )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_namespaceURI( This->node, namespaceURI );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_prefix(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR* prefixString )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_prefix( This->node, prefixString );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_baseName(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR* nameString )
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_get_baseName( This->node, nameString );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_transformNodeToObject(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMNode* stylesheet,
|
|
|
|
VARIANT outputObject)
|
|
|
|
{
|
2005-08-22 11:24:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
return IXMLDOMNode_transformNodeToObject( This->node, stylesheet, outputObject );
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_doctype(
|
|
|
|
IXMLDOMDocument *iface,
|
2005-11-08 20:59:36 +01:00
|
|
|
IXMLDOMDocumentType** documentType )
|
2005-08-02 13:29:04 +02:00
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_implementation(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMImplementation** impl )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_documentElement(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMElement** DOMElement )
|
|
|
|
{
|
2005-08-03 12:58:47 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
2005-08-10 11:54:22 +02:00
|
|
|
xmlDocPtr xmldoc = NULL;
|
|
|
|
xmlNodePtr root = NULL;
|
2005-12-01 18:46:42 +01:00
|
|
|
IXMLDOMNode *element_node;
|
|
|
|
HRESULT hr;
|
2005-08-10 11:54:22 +02:00
|
|
|
|
|
|
|
TRACE("%p\n", This);
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2005-08-10 11:54:22 +02:00
|
|
|
*DOMElement = NULL;
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2005-08-10 11:54:22 +02:00
|
|
|
if ( !This->node )
|
|
|
|
return S_FALSE;
|
|
|
|
|
2005-08-18 12:48:13 +02:00
|
|
|
xmldoc = get_doc( This );
|
2005-08-10 11:54:22 +02:00
|
|
|
if ( !xmldoc )
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
root = xmlDocGetRootElement( xmldoc );
|
|
|
|
if ( !root )
|
|
|
|
return S_FALSE;
|
|
|
|
|
2005-12-01 18:46:42 +01:00
|
|
|
element_node = create_node( root );
|
|
|
|
if(!element_node) return S_FALSE;
|
|
|
|
|
|
|
|
hr = IXMLDOMNode_QueryInterface(element_node, &IID_IXMLDOMElement, (LPVOID*)DOMElement);
|
|
|
|
IXMLDOMNode_Release(element_node);
|
|
|
|
|
|
|
|
return hr;
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_documentElement(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMElement* DOMElement )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createElement(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR tagname,
|
|
|
|
IXMLDOMElement** element )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createDocumentFragment(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMDocumentFragment** docFrag )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createTextNode(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR data,
|
|
|
|
IXMLDOMText** text )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createComment(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR data,
|
|
|
|
IXMLDOMComment** comment )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createCDATASection(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR data,
|
|
|
|
IXMLDOMCDATASection** cdata )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createProcessingInstruction(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR target,
|
|
|
|
BSTR data,
|
|
|
|
IXMLDOMProcessingInstruction** pi )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createAttribute(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR name,
|
|
|
|
IXMLDOMAttribute** attribute )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createEntityReference(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR name,
|
|
|
|
IXMLDOMEntityReference** entityRef )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_getElementsByTagName(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR tagName,
|
|
|
|
IXMLDOMNodeList** resultList )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_createNode(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT Type,
|
|
|
|
BSTR name,
|
|
|
|
BSTR namespaceURI,
|
|
|
|
IXMLDOMNode** node )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_nodeFromID(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR idString,
|
|
|
|
IXMLDOMNode** node )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-08-12 12:35:17 +02:00
|
|
|
static xmlDocPtr doparse( char *ptr, int len )
|
|
|
|
{
|
|
|
|
#ifdef HAVE_XMLREADMEMORY
|
|
|
|
/*
|
2005-08-17 11:56:24 +02:00
|
|
|
* use xmlReadMemory if possible so we can suppress
|
2005-08-12 12:35:17 +02:00
|
|
|
* writing errors to stderr
|
|
|
|
*/
|
|
|
|
return xmlReadMemory( ptr, len, NULL, NULL,
|
|
|
|
XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
|
|
|
|
#else
|
|
|
|
return xmlParseMemory( ptr, len );
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2005-08-02 13:29:04 +02:00
|
|
|
static xmlDocPtr doread( LPWSTR filename )
|
|
|
|
{
|
2005-08-08 20:34:24 +02:00
|
|
|
HANDLE handle, mapping;
|
|
|
|
DWORD len;
|
|
|
|
xmlDocPtr xmldoc = NULL;
|
|
|
|
char *ptr;
|
2005-08-02 13:29:04 +02:00
|
|
|
|
|
|
|
TRACE("%s\n", debugstr_w( filename ));
|
|
|
|
|
|
|
|
handle = CreateFileW( filename, GENERIC_READ, FILE_SHARE_READ,
|
|
|
|
NULL, OPEN_EXISTING, 0, NULL );
|
|
|
|
if( handle == INVALID_HANDLE_VALUE )
|
2005-08-08 20:34:24 +02:00
|
|
|
return xmldoc;
|
|
|
|
|
|
|
|
len = GetFileSize( handle, NULL );
|
|
|
|
if( len != INVALID_FILE_SIZE || GetLastError() == NO_ERROR )
|
|
|
|
{
|
|
|
|
mapping = CreateFileMappingW( handle, NULL, PAGE_READONLY, 0, 0, NULL );
|
|
|
|
if ( mapping )
|
|
|
|
{
|
|
|
|
ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, len );
|
|
|
|
if ( ptr )
|
|
|
|
{
|
2005-08-12 12:35:17 +02:00
|
|
|
xmldoc = doparse( ptr, len );
|
2005-08-08 20:34:24 +02:00
|
|
|
UnmapViewOfFile( ptr );
|
|
|
|
}
|
|
|
|
CloseHandle( mapping );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CloseHandle( handle );
|
2005-08-02 13:29:04 +02:00
|
|
|
|
2005-08-08 20:34:24 +02:00
|
|
|
return xmldoc;
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_load(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT xmlSource,
|
|
|
|
VARIANT_BOOL* isSuccessful )
|
|
|
|
{
|
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
LPWSTR filename = NULL;
|
2005-08-10 11:54:22 +02:00
|
|
|
xmlDocPtr xmldoc;
|
2005-08-02 13:29:04 +02:00
|
|
|
|
2005-08-10 11:54:22 +02:00
|
|
|
TRACE("type %d\n", V_VT(&xmlSource) );
|
|
|
|
|
2005-12-01 18:46:42 +01:00
|
|
|
*isSuccessful = VARIANT_FALSE;
|
|
|
|
|
|
|
|
assert( This->node );
|
|
|
|
|
|
|
|
attach_xmlnode(This->node, NULL);
|
2005-08-02 13:29:04 +02:00
|
|
|
|
|
|
|
switch( V_VT(&xmlSource) )
|
|
|
|
{
|
|
|
|
case VT_BSTR:
|
|
|
|
filename = V_BSTR(&xmlSource);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !filename )
|
2005-08-10 11:54:22 +02:00
|
|
|
return S_FALSE;
|
2005-08-02 13:29:04 +02:00
|
|
|
|
2005-08-10 11:54:22 +02:00
|
|
|
xmldoc = doread( filename );
|
2005-12-01 18:46:42 +01:00
|
|
|
if ( !xmldoc ) return S_FALSE;
|
2005-08-02 13:29:04 +02:00
|
|
|
|
2005-12-01 18:46:42 +01:00
|
|
|
xmldoc->_private = 0;
|
|
|
|
attach_xmlnode(This->node, (xmlNodePtr) xmldoc);
|
2005-08-02 13:29:04 +02:00
|
|
|
|
2005-08-10 11:54:22 +02:00
|
|
|
*isSuccessful = VARIANT_TRUE;
|
2005-08-02 13:29:04 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_readyState(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
long* value )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_parseError(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
IXMLDOMParseError** errorObj )
|
|
|
|
{
|
2005-11-08 14:10:49 +01:00
|
|
|
FIXME("(%p)->(%p): creating a dummy parseError\n", iface, errorObj);
|
|
|
|
*errorObj = create_parseError(0, NULL, NULL, NULL, 0, 0, 0);
|
|
|
|
if(!*errorObj) return E_OUTOFMEMORY;
|
|
|
|
return S_OK;
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_url(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR* urlString )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_async(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL* isAsync )
|
|
|
|
{
|
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
|
|
|
|
TRACE("%p <- %d\n", isAsync, This->async);
|
|
|
|
*isAsync = This->async;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_async(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL isAsync )
|
|
|
|
{
|
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
|
|
|
|
TRACE("%d\n", isAsync);
|
|
|
|
This->async = isAsync;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_abort(
|
|
|
|
IXMLDOMDocument *iface )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-11 12:32:36 +02:00
|
|
|
BOOL bstr_to_utf8( BSTR bstr, char **pstr, int *plen )
|
|
|
|
{
|
|
|
|
UINT len, blen = SysStringLen( bstr );
|
|
|
|
LPSTR str;
|
|
|
|
|
|
|
|
len = WideCharToMultiByte( CP_UTF8, 0, bstr, blen, NULL, 0, NULL, NULL );
|
|
|
|
str = HeapAlloc( GetProcessHeap(), 0, len );
|
|
|
|
if ( !str )
|
|
|
|
return FALSE;
|
|
|
|
WideCharToMultiByte( CP_UTF8, 0, bstr, blen, str, len, NULL, NULL );
|
|
|
|
*plen = len;
|
|
|
|
*pstr = str;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-08-02 13:29:04 +02:00
|
|
|
static HRESULT WINAPI domdoc_loadXML(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
BSTR bstrXML,
|
|
|
|
VARIANT_BOOL* isSuccessful )
|
|
|
|
{
|
2005-08-11 12:32:36 +02:00
|
|
|
domdoc *This = impl_from_IXMLDOMDocument( iface );
|
|
|
|
xmlDocPtr xmldoc;
|
|
|
|
char *str;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
TRACE("%p %s %p\n", This, debugstr_w( bstrXML ), isSuccessful );
|
|
|
|
|
2005-12-01 18:46:42 +01:00
|
|
|
assert ( This->node );
|
|
|
|
|
|
|
|
attach_xmlnode( This->node, NULL );
|
2005-08-11 12:32:36 +02:00
|
|
|
|
|
|
|
if ( !isSuccessful )
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
*isSuccessful = VARIANT_FALSE;
|
|
|
|
|
|
|
|
if ( !bstrXML )
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
if ( !bstr_to_utf8( bstrXML, &str, &len ) )
|
|
|
|
return S_FALSE;
|
|
|
|
|
2005-08-12 12:35:17 +02:00
|
|
|
xmldoc = doparse( str, len );
|
2005-08-11 12:32:36 +02:00
|
|
|
HeapFree( GetProcessHeap(), 0, str );
|
2005-12-01 18:46:42 +01:00
|
|
|
if ( !xmldoc )
|
2005-08-11 12:32:36 +02:00
|
|
|
return S_FALSE;
|
|
|
|
|
2005-12-01 18:46:42 +01:00
|
|
|
xmldoc->_private = 0;
|
|
|
|
attach_xmlnode( This->node, (xmlNodePtr) xmldoc );
|
|
|
|
|
2005-08-11 12:32:36 +02:00
|
|
|
*isSuccessful = VARIANT_TRUE;
|
|
|
|
return S_OK;
|
2005-08-02 13:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_save(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT destination )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_validateOnParse(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL* isValidating )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_validateOnParse(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL isValidating )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_resolveExternals(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL* isResolving )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_resolveExternals(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL isValidating )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_get_preserveWhiteSpace(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL* isPreserving )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_preserveWhiteSpace(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT_BOOL isPreserving )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_onReadyStateChange(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT readyStateChangeSink )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_onDataAvailable(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT onDataAvailableSink )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI domdoc_put_onTransformNode(
|
|
|
|
IXMLDOMDocument *iface,
|
|
|
|
VARIANT onTransformNodeSink )
|
|
|
|
{
|
|
|
|
FIXME("\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const struct IXMLDOMDocumentVtbl domdoc_vtbl =
|
|
|
|
{
|
|
|
|
domdoc_QueryInterface,
|
|
|
|
domdoc_AddRef,
|
|
|
|
domdoc_Release,
|
|
|
|
domdoc_GetTypeInfoCount,
|
|
|
|
domdoc_GetTypeInfo,
|
|
|
|
domdoc_GetIDsOfNames,
|
|
|
|
domdoc_Invoke,
|
|
|
|
domdoc_get_nodeName,
|
|
|
|
domdoc_get_nodeValue,
|
|
|
|
domdoc_put_nodeValue,
|
|
|
|
domdoc_get_nodeType,
|
|
|
|
domdoc_get_parentNode,
|
|
|
|
domdoc_get_childNodes,
|
|
|
|
domdoc_get_firstChild,
|
|
|
|
domdoc_get_lastChild,
|
|
|
|
domdoc_get_previousSibling,
|
|
|
|
domdoc_get_nextSibling,
|
|
|
|
domdoc_get_attributes,
|
|
|
|
domdoc_insertBefore,
|
|
|
|
domdoc_replaceChild,
|
|
|
|
domdoc_removeChild,
|
|
|
|
domdoc_appendChild,
|
|
|
|
domdoc_hasChildNodes,
|
|
|
|
domdoc_get_ownerDocument,
|
|
|
|
domdoc_cloneNode,
|
|
|
|
domdoc_get_nodeTypeString,
|
|
|
|
domdoc_get_text,
|
|
|
|
domdoc_put_text,
|
|
|
|
domdoc_get_specified,
|
|
|
|
domdoc_get_definition,
|
|
|
|
domdoc_get_nodeTypedValue,
|
|
|
|
domdoc_put_nodeTypedValue,
|
|
|
|
domdoc_get_dataType,
|
|
|
|
domdoc_put_dataType,
|
|
|
|
domdoc_get_xml,
|
|
|
|
domdoc_transformNode,
|
|
|
|
domdoc_selectNodes,
|
|
|
|
domdoc_selectSingleNode,
|
|
|
|
domdoc_get_parsed,
|
|
|
|
domdoc_get_namespaceURI,
|
|
|
|
domdoc_get_prefix,
|
|
|
|
domdoc_get_baseName,
|
|
|
|
domdoc_transformNodeToObject,
|
|
|
|
domdoc_get_doctype,
|
|
|
|
domdoc_get_implementation,
|
|
|
|
domdoc_get_documentElement,
|
|
|
|
domdoc_documentElement,
|
|
|
|
domdoc_createElement,
|
|
|
|
domdoc_createDocumentFragment,
|
|
|
|
domdoc_createTextNode,
|
|
|
|
domdoc_createComment,
|
|
|
|
domdoc_createCDATASection,
|
|
|
|
domdoc_createProcessingInstruction,
|
|
|
|
domdoc_createAttribute,
|
|
|
|
domdoc_createEntityReference,
|
|
|
|
domdoc_getElementsByTagName,
|
|
|
|
domdoc_createNode,
|
|
|
|
domdoc_nodeFromID,
|
|
|
|
domdoc_load,
|
|
|
|
domdoc_get_readyState,
|
|
|
|
domdoc_get_parseError,
|
|
|
|
domdoc_get_url,
|
|
|
|
domdoc_get_async,
|
|
|
|
domdoc_put_async,
|
|
|
|
domdoc_abort,
|
|
|
|
domdoc_loadXML,
|
|
|
|
domdoc_save,
|
|
|
|
domdoc_get_validateOnParse,
|
|
|
|
domdoc_put_validateOnParse,
|
|
|
|
domdoc_get_resolveExternals,
|
|
|
|
domdoc_put_resolveExternals,
|
|
|
|
domdoc_get_preserveWhiteSpace,
|
|
|
|
domdoc_put_preserveWhiteSpace,
|
|
|
|
domdoc_put_onReadyStateChange,
|
|
|
|
domdoc_put_onDataAvailable,
|
|
|
|
domdoc_put_onTransformNode,
|
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
|
|
|
{
|
|
|
|
domdoc *doc;
|
2005-12-01 18:46:42 +01:00
|
|
|
HRESULT hr;
|
|
|
|
|
|
|
|
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
|
2005-08-02 13:29:04 +02:00
|
|
|
|
|
|
|
doc = HeapAlloc( GetProcessHeap(), 0, sizeof (*doc) );
|
|
|
|
if( !doc )
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
doc->lpVtbl = &domdoc_vtbl;
|
|
|
|
doc->ref = 1;
|
|
|
|
doc->async = 0;
|
2005-12-01 18:46:42 +01:00
|
|
|
|
|
|
|
doc->node_unk = create_basic_node( NULL, (IUnknown*)&doc->lpVtbl );
|
|
|
|
if(!doc->node_unk)
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, doc);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IUnknown_QueryInterface(doc->node_unk, &IID_IXMLDOMNode, (LPVOID*)&doc->node);
|
|
|
|
if(FAILED(hr))
|
|
|
|
{
|
|
|
|
IUnknown_Release(doc->node_unk);
|
|
|
|
HeapFree( GetProcessHeap(), 0, doc );
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
/* The ref on doc->node is actually looped back into this object, so release it */
|
|
|
|
IXMLDOMNode_Release(doc->node);
|
2005-08-02 13:29:04 +02:00
|
|
|
|
|
|
|
*ppObj = &doc->lpVtbl;
|
|
|
|
|
2005-12-01 18:46:42 +01:00
|
|
|
TRACE("returning iface %p\n", *ppObj);
|
2005-08-02 13:29:04 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
|
|
|
|
{
|
|
|
|
MESSAGE("This program tried to use a DOMDocument object, but\n"
|
|
|
|
"libxml2 support was not present at compile time.\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|