shell32: Update Korean resource.
[wine/multimedia.git] / dlls / msxml3 / msxml_private.h
blobdcd305a17b7bfc47e4f736a0fbe7382232dbcaee
1 /*
2 * Common definitions
4 * Copyright 2005 Mike McCormack
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __MSXML_PRIVATE__
22 #define __MSXML_PRIVATE__
24 #include "dispex.h"
26 #include "wine/unicode.h"
28 #ifndef __WINE_CONFIG_H
29 # error You must include config.h to use this header
30 #endif
32 typedef enum {
33 MSXML_DEFAULT = 0,
34 MSXML3 = 30,
35 MSXML4 = 40,
36 MSXML6 = 60
37 } MSXML_VERSION;
39 /* typelibs */
40 typedef enum tid_t {
41 IXMLDOMAttribute_tid,
42 IXMLDOMCDATASection_tid,
43 IXMLDOMComment_tid,
44 IXMLDOMDocument_tid,
45 IXMLDOMDocument2_tid,
46 IXMLDOMDocumentFragment_tid,
47 IXMLDOMDocumentType_tid,
48 IXMLDOMElement_tid,
49 IXMLDOMEntityReference_tid,
50 IXMLDOMImplementation_tid,
51 IXMLDOMNamedNodeMap_tid,
52 IXMLDOMNode_tid,
53 IXMLDOMNodeList_tid,
54 IXMLDOMParseError_tid,
55 IXMLDOMProcessingInstruction_tid,
56 IXMLDOMSchemaCollection_tid,
57 IXMLDOMSelection_tid,
58 IXMLDOMText_tid,
59 IXMLElement_tid,
60 IXMLDocument_tid,
61 IXMLHTTPRequest_tid,
62 IXSLProcessor_tid,
63 IXSLTemplate_tid,
64 IVBSAXAttributes_tid,
65 IVBSAXContentHandler_tid,
66 IVBSAXDeclHandler_tid,
67 IVBSAXDTDHandler_tid,
68 IVBSAXEntityResolver_tid,
69 IVBSAXErrorHandler_tid,
70 IVBSAXLexicalHandler_tid,
71 IVBSAXLocator_tid,
72 IVBSAXXMLFilter_tid,
73 IVBSAXXMLReader_tid,
74 IMXAttributes_tid,
75 IMXReaderControl_tid,
76 IMXWriter_tid,
77 LAST_tid
78 } tid_t;
80 /* The XDR datatypes (urn:schemas-microsoft-com:datatypes)
81 * These are actually valid for XSD schemas as well
82 * See datatypes.xsd
84 typedef enum _XDR_DT {
85 DT_INVALID = -1,
86 DT_BIN_BASE64,
87 DT_BIN_HEX,
88 DT_BOOLEAN,
89 DT_CHAR,
90 DT_DATE,
91 DT_DATE_TZ,
92 DT_DATETIME,
93 DT_DATETIME_TZ,
94 DT_ENTITY,
95 DT_ENTITIES,
96 DT_ENUMERATION,
97 DT_FIXED_14_4,
98 DT_FLOAT,
99 DT_I1,
100 DT_I2,
101 DT_I4,
102 DT_I8,
103 DT_ID,
104 DT_IDREF,
105 DT_IDREFS,
106 DT_INT,
107 DT_NMTOKEN,
108 DT_NMTOKENS,
109 DT_NOTATION,
110 DT_NUMBER,
111 DT_R4,
112 DT_R8,
113 DT_STRING,
114 DT_TIME,
115 DT_TIME_TZ,
116 DT_UI1,
117 DT_UI2,
118 DT_UI4,
119 DT_UI8,
120 DT_URI,
121 DT_UUID
122 } XDR_DT;
123 #define DT__N_TYPES (DT_UUID+1)
125 extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
126 extern void release_typelib(void) DECLSPEC_HIDDEN;
128 typedef struct dispex_data_t dispex_data_t;
129 typedef struct dispex_dynamic_data_t dispex_dynamic_data_t;
131 #define MSXML_DISPID_CUSTOM_MIN 0x60000000
132 #define MSXML_DISPID_CUSTOM_MAX 0x6fffffff
134 typedef struct {
135 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
136 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
137 } dispex_static_data_vtbl_t;
139 typedef struct {
140 const dispex_static_data_vtbl_t *vtbl;
141 const tid_t disp_tid;
142 dispex_data_t *data;
143 const tid_t* const iface_tids;
144 } dispex_static_data_t;
146 typedef struct {
147 IDispatchEx IDispatchEx_iface;
149 IUnknown *outer;
151 dispex_static_data_t *data;
152 dispex_dynamic_data_t *dynamic_data;
153 } DispatchEx;
155 extern HINSTANCE MSXML_hInstance DECLSPEC_HIDDEN;
157 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
158 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
160 /* memory allocation functions */
162 static inline void *heap_alloc(size_t len)
164 return HeapAlloc(GetProcessHeap(), 0, len);
167 static inline void *heap_alloc_zero(size_t len)
169 return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
172 static inline void *heap_realloc(void *mem, size_t len)
174 return HeapReAlloc(GetProcessHeap(), 0, mem, len);
177 static inline BOOL heap_free(void *mem)
179 return HeapFree(GetProcessHeap(), 0, mem);
182 static inline LPWSTR heap_strdupW(LPCWSTR str)
184 LPWSTR ret = NULL;
186 if(str) {
187 DWORD size;
189 size = (strlenW(str)+1)*sizeof(WCHAR);
190 ret = heap_alloc(size);
191 memcpy(ret, str, size);
194 return ret;
197 #ifdef HAVE_LIBXML2
199 extern void schemasInit(void) DECLSPEC_HIDDEN;
200 extern void schemasCleanup(void) DECLSPEC_HIDDEN;
202 #ifndef HAVE_XMLFIRSTELEMENTCHILD
203 static inline xmlNodePtr wine_xmlFirstElementChild(xmlNodePtr parent)
205 xmlNodePtr child;
206 for (child = parent->children; child != NULL; child = child->next)
207 if (child->type == XML_ELEMENT_NODE)
208 break;
210 return child;
212 #define xmlFirstElementChild wine_xmlFirstElementChild
213 #endif
215 /* constructors */
216 extern IUnknown *create_domdoc( xmlNodePtr ) DECLSPEC_HIDDEN;
217 extern IUnknown *create_xmldoc( void ) DECLSPEC_HIDDEN;
218 extern IXMLDOMNode *create_node( xmlNodePtr ) DECLSPEC_HIDDEN;
219 extern IUnknown *create_element( xmlNodePtr ) DECLSPEC_HIDDEN;
220 extern IUnknown *create_attribute( xmlNodePtr ) DECLSPEC_HIDDEN;
221 extern IUnknown *create_text( xmlNodePtr ) DECLSPEC_HIDDEN;
222 extern IUnknown *create_pi( xmlNodePtr ) DECLSPEC_HIDDEN;
223 extern IUnknown *create_comment( xmlNodePtr ) DECLSPEC_HIDDEN;
224 extern IUnknown *create_cdata( xmlNodePtr ) DECLSPEC_HIDDEN;
225 extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr ) DECLSPEC_HIDDEN;
226 extern IXMLDOMNamedNodeMap *create_nodemap( const xmlNodePtr ) DECLSPEC_HIDDEN;
227 extern IUnknown *create_doc_Implementation(void) DECLSPEC_HIDDEN;
228 extern IUnknown *create_doc_fragment( xmlNodePtr ) DECLSPEC_HIDDEN;
229 extern IUnknown *create_doc_entity_ref( xmlNodePtr ) DECLSPEC_HIDDEN;
230 extern IUnknown *create_doc_type( xmlNodePtr ) DECLSPEC_HIDDEN;
231 extern HRESULT create_selection( xmlNodePtr, xmlChar*, IXMLDOMNodeList** ) DECLSPEC_HIDDEN;
233 /* data accessors */
234 xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type ) DECLSPEC_HIDDEN;
236 /* helpers */
237 extern xmlChar *xmlChar_from_wchar( LPCWSTR str ) DECLSPEC_HIDDEN;
239 extern void xmldoc_init( xmlDocPtr doc, const GUID *clsid ) DECLSPEC_HIDDEN;
240 extern LONG xmldoc_add_ref( xmlDocPtr doc ) DECLSPEC_HIDDEN;
241 extern LONG xmldoc_release( xmlDocPtr doc ) DECLSPEC_HIDDEN;
242 extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN;
243 extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN;
244 extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node) DECLSPEC_HIDDEN;
245 extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc) DECLSPEC_HIDDEN;
247 extern HRESULT XMLElement_create( IUnknown *pUnkOuter, xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN;
249 extern void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap) DECLSPEC_HIDDEN;
250 extern void wineXmlCallbackError(char const* caller, xmlErrorPtr err) DECLSPEC_HIDDEN;
252 #define LIBXML2_LOG_CALLBACK __WINE_PRINTF_ATTR(2,3)
254 #define LIBXML2_CALLBACK_TRACE(caller, msg, ap) \
255 wineXmlCallbackLog(#caller, XML_ERR_NONE, msg, ap)
257 #define LIBXML2_CALLBACK_WARN(caller, msg, ap) \
258 wineXmlCallbackLog(#caller, XML_ERR_WARNING, msg, ap)
260 #define LIBXML2_CALLBACK_ERR(caller, msg, ap) \
261 wineXmlCallbackLog(#caller, XML_ERR_ERROR, msg, ap)
263 #define LIBXML2_CALLBACK_SERROR(caller, err) wineXmlCallbackError(#caller, err)
265 extern BOOL is_preserving_whitespace(xmlNodePtr node) DECLSPEC_HIDDEN;
266 extern BOOL is_xpathmode(const xmlDocPtr doc) DECLSPEC_HIDDEN;
267 extern void set_xpathmode(xmlDocPtr doc, BOOL xpath) DECLSPEC_HIDDEN;
269 /* IXMLDOMNode Internal Structure */
270 typedef struct _xmlnode
272 DispatchEx dispex;
273 IXMLDOMNode *iface;
274 IXMLDOMNode *parent;
275 xmlNodePtr node;
276 } xmlnode;
278 extern void init_xmlnode(xmlnode*,xmlNodePtr,IXMLDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
279 extern void destroy_xmlnode(xmlnode*) DECLSPEC_HIDDEN;
280 extern BOOL node_query_interface(xmlnode*,REFIID,void**) DECLSPEC_HIDDEN;
281 extern xmlnode *get_node_obj(IXMLDOMNode*) DECLSPEC_HIDDEN;
283 extern HRESULT node_append_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
284 extern HRESULT node_get_nodeName(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
285 extern HRESULT node_get_content(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
286 extern HRESULT node_set_content(xmlnode*,LPCWSTR) DECLSPEC_HIDDEN;
287 extern HRESULT node_put_value(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
288 extern HRESULT node_put_value_escaped(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
289 extern HRESULT node_get_parent(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
290 extern HRESULT node_get_child_nodes(xmlnode*,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
291 extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
292 extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
293 extern HRESULT node_get_previous_sibling(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
294 extern HRESULT node_get_next_sibling(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
295 extern HRESULT node_insert_before(xmlnode*,IXMLDOMNode*,const VARIANT*,IXMLDOMNode**) DECLSPEC_HIDDEN;
296 extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
297 extern HRESULT node_put_text(xmlnode*,BSTR) DECLSPEC_HIDDEN;
298 extern HRESULT node_get_xml(xmlnode*,BOOL,BOOL,BSTR*) DECLSPEC_HIDDEN;
299 extern HRESULT node_clone(xmlnode*,VARIANT_BOOL,IXMLDOMNode**) DECLSPEC_HIDDEN;
300 extern HRESULT node_get_prefix(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
301 extern HRESULT node_get_base_name(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
302 extern HRESULT node_get_namespaceURI(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
303 extern HRESULT node_remove_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
304 extern HRESULT node_has_childnodes(const xmlnode*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
305 extern HRESULT node_get_owner_doc(const xmlnode*,IXMLDOMDocument**) DECLSPEC_HIDDEN;
306 extern HRESULT node_get_text(const xmlnode*,BSTR*) DECLSPEC_HIDDEN;
307 extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
308 extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**) DECLSPEC_HIDDEN;
309 extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
311 extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) DECLSPEC_HIDDEN;
313 extern HRESULT SchemaCache_validate_tree(IXMLDOMSchemaCollection2* iface, xmlNodePtr tree) DECLSPEC_HIDDEN;
314 extern XDR_DT SchemaCache_get_node_dt(IXMLDOMSchemaCollection2* iface, xmlNodePtr node) DECLSPEC_HIDDEN;
316 extern XDR_DT str_to_dt(xmlChar const* str, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
317 extern XDR_DT bstr_to_dt(OLECHAR const* bstr, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
318 extern xmlChar const* dt_to_str(XDR_DT dt) DECLSPEC_HIDDEN;
319 extern OLECHAR const* dt_to_bstr(XDR_DT dt) DECLSPEC_HIDDEN;
320 extern HRESULT dt_validate(XDR_DT dt, xmlChar const* content) DECLSPEC_HIDDEN;
322 extern BSTR EnsureCorrectEOL(BSTR) DECLSPEC_HIDDEN;
324 extern xmlChar* tagName_to_XPath(const BSTR tagName) DECLSPEC_HIDDEN;
326 static inline BSTR bstr_from_xmlChar(const xmlChar *str)
328 BSTR ret = NULL;
330 if(str) {
331 DWORD len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, NULL, 0);
332 ret = SysAllocStringLen(NULL, len-1);
333 if(ret)
334 MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)str, -1, ret, len);
336 else
337 ret = SysAllocStringLen(NULL, 0);
339 return ret;
342 static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
344 if(!p)
345 return E_INVALIDARG;
347 if(value) {
348 *p = SysAllocString(value);
349 if(!*p)
350 return E_OUTOFMEMORY;
351 }else {
352 *p = NULL;
355 return S_OK;
358 static inline HRESULT return_null_node(IXMLDOMNode **p)
360 if(!p)
361 return E_INVALIDARG;
362 *p = NULL;
363 return S_FALSE;
366 static inline HRESULT return_null_ptr(void **p)
368 if(!p)
369 return E_INVALIDARG;
370 *p = NULL;
371 return S_FALSE;
374 static inline HRESULT return_null_var(VARIANT *p)
376 if(!p)
377 return E_INVALIDARG;
379 V_VT(p) = VT_NULL;
380 return S_FALSE;
383 static inline HRESULT return_null_bstr(BSTR *p)
385 if(!p)
386 return E_INVALIDARG;
388 *p = NULL;
389 return S_FALSE;
392 static inline xmlChar *xmlchar_from_wcharn(const WCHAR *str, int nchars)
394 xmlChar *xmlstr;
395 DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, nchars, NULL, 0, NULL, NULL );
397 xmlstr = heap_alloc( len+1 );
398 if ( xmlstr )
400 WideCharToMultiByte( CP_UTF8, 0, str, nchars, (LPSTR) xmlstr, len+1, NULL, NULL );
401 xmlstr[len] = 0;
403 return xmlstr;
406 static inline xmlChar *xmlchar_from_wchar( const WCHAR *str )
408 return xmlchar_from_wcharn(str, -1);
411 #endif
413 extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
414 LONG line, LONG linepos, LONG filepos ) DECLSPEC_HIDDEN;
415 extern HRESULT DOMDocument_create(const GUID*, IUnknown*, void**) DECLSPEC_HIDDEN;
416 extern HRESULT SchemaCache_create(const GUID*, IUnknown*, void**) DECLSPEC_HIDDEN;
417 extern HRESULT XMLDocument_create(IUnknown*, void**) DECLSPEC_HIDDEN;
418 extern HRESULT SAXXMLReader_create(IUnknown*, void**) DECLSPEC_HIDDEN;
419 extern HRESULT XMLHTTPRequest_create(IUnknown*, void **) DECLSPEC_HIDDEN;
420 extern HRESULT XSLTemplate_create(IUnknown*, void**) DECLSPEC_HIDDEN;
421 extern HRESULT MXWriter_create(IUnknown*,void**) DECLSPEC_HIDDEN;
423 static inline const CLSID* DOMDocument_version(MSXML_VERSION v)
425 switch (v)
427 default:
428 case MSXML_DEFAULT: return &CLSID_DOMDocument;
429 case MSXML3: return &CLSID_DOMDocument30;
430 case MSXML4: return &CLSID_DOMDocument40;
431 case MSXML6: return &CLSID_DOMDocument60;
435 static inline const CLSID* SchemaCache_version(MSXML_VERSION v)
437 switch (v)
439 default:
440 case MSXML_DEFAULT: return &CLSID_XMLSchemaCache;
441 case MSXML3: return &CLSID_XMLSchemaCache30;
442 case MSXML4: return &CLSID_XMLSchemaCache40;
443 case MSXML6: return &CLSID_XMLSchemaCache60;
447 typedef struct bsc_t bsc_t;
449 HRESULT bind_url(LPCWSTR, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**) DECLSPEC_HIDDEN;
450 void detach_bsc(bsc_t*) DECLSPEC_HIDDEN;
452 const char *debugstr_variant(const VARIANT*) DECLSPEC_HIDDEN;
454 /* Error Codes - not defined anywhere in the public headers */
455 #define E_XML_ELEMENT_UNDECLARED 0xC00CE00D
456 #define E_XML_ELEMENT_ID_NOT_FOUND 0xC00CE00E
457 /* ... */
458 #define E_XML_EMPTY_NOT_ALLOWED 0xC00CE011
459 #define E_XML_ELEMENT_NOT_COMPLETE 0xC00CE012
460 #define E_XML_ROOT_NAME_MISMATCH 0xC00CE013
461 #define E_XML_INVALID_CONTENT 0xC00CE014
462 #define E_XML_ATTRIBUTE_NOT_DEFINED 0xC00CE015
463 #define E_XML_ATTRIBUTE_FIXED 0xC00CE016
464 #define E_XML_ATTRIBUTE_VALUE 0xC00CE017
465 #define E_XML_ILLEGAL_TEXT 0xC00CE018
466 /* ... */
467 #define E_XML_REQUIRED_ATTRIBUTE_MISSING 0xC00CE020
469 #endif /* __MSXML_PRIVATE__ */