2005-08-02 13:29:04 +02:00
|
|
|
/*
|
|
|
|
* MSXML Class Factory
|
|
|
|
*
|
|
|
|
* Copyright 2005 Mike McCormack
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* 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
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-08-02 13:29:04 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MSXML_PRIVATE__
|
|
|
|
#define __MSXML_PRIVATE__
|
|
|
|
|
2008-08-21 23:37:48 +02:00
|
|
|
#include "dispex.h"
|
|
|
|
|
|
|
|
#include "wine/unicode.h"
|
|
|
|
|
2007-01-20 09:19:55 +01:00
|
|
|
#ifndef __WINE_CONFIG_H
|
|
|
|
# error You must include config.h to use this header
|
|
|
|
#endif
|
|
|
|
|
2005-08-08 14:13:31 +02:00
|
|
|
#ifdef HAVE_LIBXML2
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2005-08-15 11:43:53 +02:00
|
|
|
#ifdef HAVE_LIBXML_PARSER_H
|
2005-08-03 12:58:47 +02:00
|
|
|
#include <libxml/parser.h>
|
2005-08-15 11:43:53 +02:00
|
|
|
#endif
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2005-08-10 11:54:22 +02:00
|
|
|
/* constructors */
|
2008-07-16 14:13:18 +02:00
|
|
|
extern IUnknown *create_domdoc( xmlNodePtr document );
|
2005-08-10 11:54:22 +02:00
|
|
|
extern IUnknown *create_xmldoc( void );
|
2005-08-19 12:03:27 +02:00
|
|
|
extern IXMLDOMNode *create_node( xmlNodePtr node );
|
2005-12-01 18:46:42 +01:00
|
|
|
extern IUnknown *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter );
|
2006-06-14 03:37:54 +02:00
|
|
|
extern IUnknown *create_element( xmlNodePtr element, IUnknown *pUnkOuter );
|
2006-02-16 19:37:53 +01:00
|
|
|
extern IUnknown *create_attribute( xmlNodePtr attribute );
|
2006-01-19 11:56:34 +01:00
|
|
|
extern IUnknown *create_text( xmlNodePtr text );
|
2006-11-17 00:17:00 +01:00
|
|
|
extern IUnknown *create_pi( xmlNodePtr pi );
|
2006-02-16 19:37:53 +01:00
|
|
|
extern IUnknown *create_comment( xmlNodePtr comment );
|
2008-01-14 03:25:13 +01:00
|
|
|
extern IUnknown *create_cdata( xmlNodePtr text );
|
2007-05-11 17:03:13 +02:00
|
|
|
extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr );
|
2005-08-19 12:03:27 +02:00
|
|
|
extern IXMLDOMNamedNodeMap *create_nodemap( IXMLDOMNode *node );
|
2008-01-18 10:33:03 +01:00
|
|
|
extern IUnknown *create_doc_Implementation();
|
2008-01-19 13:23:49 +01:00
|
|
|
extern IUnknown *create_doc_fragment( xmlNodePtr fragment );
|
2008-01-21 22:33:32 +01:00
|
|
|
extern IUnknown *create_doc_entity_ref( xmlNodePtr entity );
|
2007-05-11 17:03:13 +02:00
|
|
|
|
|
|
|
extern HRESULT queryresult_create( xmlNodePtr, LPWSTR, IXMLDOMNodeList ** );
|
2005-08-10 11:54:22 +02:00
|
|
|
|
|
|
|
/* data accessors */
|
2005-08-18 12:48:13 +02:00
|
|
|
xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type );
|
2005-08-10 11:54:22 +02:00
|
|
|
|
|
|
|
/* helpers */
|
|
|
|
extern xmlChar *xmlChar_from_wchar( LPWSTR str );
|
|
|
|
extern BSTR bstr_from_xmlChar( const xmlChar *buf );
|
2005-08-03 12:58:47 +02:00
|
|
|
|
2005-11-18 16:05:26 +01:00
|
|
|
extern LONG xmldoc_add_ref( xmlDocPtr doc );
|
|
|
|
extern LONG xmldoc_release( xmlDocPtr doc );
|
2008-10-11 23:59:19 +02:00
|
|
|
extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node );
|
|
|
|
extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node );
|
2007-05-29 12:05:20 +02:00
|
|
|
|
|
|
|
extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj );
|
|
|
|
extern HRESULT XMLElementCollection_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj );
|
|
|
|
|
2007-12-09 23:31:38 +01:00
|
|
|
extern xmlDocPtr parse_xml(char *ptr, int len);
|
|
|
|
|
2008-01-03 23:06:03 +01:00
|
|
|
/* IXMLDOMNode Internal Structure */
|
|
|
|
typedef struct _xmlnode
|
|
|
|
{
|
|
|
|
const struct IXMLDOMNodeVtbl *lpVtbl;
|
|
|
|
const struct IUnknownVtbl *lpInternalUnkVtbl;
|
|
|
|
IUnknown *pUnkOuter;
|
|
|
|
LONG ref;
|
|
|
|
xmlNodePtr node;
|
|
|
|
} xmlnode;
|
|
|
|
|
|
|
|
static inline xmlnode *impl_from_IXMLDOMNode( IXMLDOMNode *iface )
|
|
|
|
{
|
|
|
|
return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpVtbl));
|
|
|
|
}
|
|
|
|
|
2008-07-14 11:48:37 +02:00
|
|
|
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
|
|
|
|
|
2008-01-07 20:04:50 +01:00
|
|
|
#endif
|
|
|
|
|
2008-11-17 19:29:32 +01:00
|
|
|
void* libxslt_handle;
|
|
|
|
#ifdef SONAME_LIBXSLT
|
|
|
|
# ifdef HAVE_LIBXSLT_PATTERN_H
|
|
|
|
# include <libxslt/pattern.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_LIBXSLT_TRANSFORM_H
|
|
|
|
# include <libxslt/transform.h>
|
|
|
|
# endif
|
|
|
|
# include <libxslt/xsltutils.h>
|
|
|
|
# include <libxslt/xsltInternals.h>
|
|
|
|
|
|
|
|
# define MAKE_FUNCPTR(f) extern typeof(f) * p##f
|
|
|
|
MAKE_FUNCPTR(xsltApplyStylesheet);
|
|
|
|
MAKE_FUNCPTR(xsltCleanupGlobals);
|
|
|
|
MAKE_FUNCPTR(xsltFreeStylesheet);
|
|
|
|
MAKE_FUNCPTR(xsltParseStylesheetDoc);
|
|
|
|
# undef MAKE_FUNCPTR
|
|
|
|
#endif
|
|
|
|
|
2008-01-07 20:04:50 +01:00
|
|
|
extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
|
|
|
|
LONG line, LONG linepos, LONG filepos );
|
|
|
|
extern HRESULT DOMDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
|
|
|
extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
|
|
|
extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
|
2008-03-25 04:19:10 +01:00
|
|
|
extern HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj );
|
2008-10-03 13:50:59 +02:00
|
|
|
extern HRESULT XMLHTTPRequest_create(IUnknown *pUnkOuter, LPVOID *ppObj);
|
2008-01-07 20:04:50 +01:00
|
|
|
|
2008-07-27 19:54:38 +02:00
|
|
|
typedef struct bsc_t bsc_t;
|
|
|
|
|
|
|
|
HRESULT bind_url(LPCWSTR, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**);
|
|
|
|
void detach_bsc(bsc_t*);
|
|
|
|
|
2008-02-14 10:55:33 +01:00
|
|
|
/* typelibs */
|
2008-08-21 23:37:48 +02:00
|
|
|
typedef enum tid_t {
|
2008-02-14 10:55:33 +01:00
|
|
|
IXMLDOMAttribute_tid,
|
|
|
|
IXMLDOMCDATASection_tid,
|
|
|
|
IXMLDOMComment_tid,
|
2008-09-03 02:23:10 +02:00
|
|
|
IXMLDOMDocument_tid,
|
2008-02-14 10:55:33 +01:00
|
|
|
IXMLDOMDocument2_tid,
|
|
|
|
IXMLDOMDocumentFragment_tid,
|
|
|
|
IXMLDOMElement_tid,
|
|
|
|
IXMLDOMEntityReference_tid,
|
2008-02-20 13:05:45 +01:00
|
|
|
IXMLDOMImplementation_tid,
|
2008-02-14 10:55:33 +01:00
|
|
|
IXMLDOMNamedNodeMap_tid,
|
2008-04-29 12:25:14 +02:00
|
|
|
IXMLDOMNode_tid,
|
2008-02-14 10:55:33 +01:00
|
|
|
IXMLDOMNodeList_tid,
|
|
|
|
IXMLDOMParseError_tid,
|
|
|
|
IXMLDOMProcessingInstruction_tid,
|
|
|
|
IXMLDOMSchemaCollection_tid,
|
|
|
|
IXMLDOMText_tid,
|
|
|
|
IXMLElement_tid,
|
|
|
|
IXMLDocument_tid,
|
2008-10-03 13:50:59 +02:00
|
|
|
IXMLHTTPRequest_tid,
|
2008-03-25 03:53:30 +01:00
|
|
|
IVBSAXAttributes_tid,
|
|
|
|
IVBSAXContentHandler_tid,
|
|
|
|
IVBSAXDeclHandler_tid,
|
|
|
|
IVBSAXDTDHandler_tid,
|
|
|
|
IVBSAXEntityResolver_tid,
|
|
|
|
IVBSAXErrorHandler_tid,
|
|
|
|
IVBSAXLexicalHandler_tid,
|
|
|
|
IVBSAXLocator_tid,
|
|
|
|
IVBSAXXMLFilter_tid,
|
|
|
|
IVBSAXXMLReader_tid,
|
|
|
|
IMXAttributes_tid,
|
|
|
|
IMXReaderControl_tid,
|
|
|
|
IMXWriter_tid,
|
2008-02-14 10:55:33 +01:00
|
|
|
LAST_tid
|
2008-08-21 23:37:48 +02:00
|
|
|
} tid_t;
|
|
|
|
|
|
|
|
extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo);
|
|
|
|
extern void release_typelib(void);
|
|
|
|
|
|
|
|
typedef struct dispex_data_t dispex_data_t;
|
|
|
|
typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
|
|
|
|
|
|
|
|
#define MSXML_DISPID_CUSTOM_MIN 0x60000000
|
|
|
|
#define MSXML_DISPID_CUSTOM_MAX 0x6fffffff
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
|
|
|
|
HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
|
|
|
|
} dispex_static_data_vtbl_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const dispex_static_data_vtbl_t *vtbl;
|
|
|
|
const tid_t disp_tid;
|
|
|
|
dispex_data_t *data;
|
|
|
|
const tid_t* const iface_tids;
|
|
|
|
} dispex_static_data_t;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
const IDispatchExVtbl *lpIDispatchExVtbl;
|
|
|
|
|
|
|
|
IUnknown *outer;
|
|
|
|
|
|
|
|
dispex_static_data_t *data;
|
|
|
|
dispex_dynamic_data_t *dynamic_data;
|
|
|
|
} DispatchEx;
|
|
|
|
|
|
|
|
void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
|
|
|
|
BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
|
|
|
|
|
|
|
|
/* memory allocation functions */
|
|
|
|
|
|
|
|
static inline void *heap_alloc(size_t len)
|
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), 0, len);
|
|
|
|
}
|
2008-02-14 10:55:33 +01:00
|
|
|
|
2008-08-21 23:37:48 +02:00
|
|
|
static inline void *heap_alloc_zero(size_t len)
|
|
|
|
{
|
|
|
|
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void *heap_realloc(void *mem, size_t len)
|
|
|
|
{
|
|
|
|
return HeapReAlloc(GetProcessHeap(), 0, mem, len);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline BOOL heap_free(void *mem)
|
|
|
|
{
|
|
|
|
return HeapFree(GetProcessHeap(), 0, mem);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline LPWSTR heap_strdupW(LPCWSTR str)
|
|
|
|
{
|
|
|
|
LPWSTR ret = NULL;
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
DWORD size;
|
|
|
|
|
|
|
|
size = (strlenW(str)+1)*sizeof(WCHAR);
|
|
|
|
ret = heap_alloc(size);
|
|
|
|
memcpy(ret, str, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2008-02-14 10:55:33 +01:00
|
|
|
|
2005-08-02 13:29:04 +02:00
|
|
|
#endif /* __MSXML_PRIVATE__ */
|