[XDK][PSDK][WINE] Unify ARRAY_SIZE definition for Wine modules. CORE-15127
[reactos.git] / dll / win32 / msxml3 / msxml_private.h
1 /*
2 * Common definitions
3 *
4 * Copyright 2005 Mike McCormack
5 *
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.
10 *
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.
15 *
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
19 */
20
21 #ifndef __MSXML_PRIVATE__
22 #define __MSXML_PRIVATE__
23
24 #include "dispex.h"
25
26 #include "wine/unicode.h"
27 #include "wine/heap.h"
28 #include "wine/list.h"
29
30 #ifndef __WINE_CONFIG_H
31 # error You must include config.h to use this header
32 #endif
33
34 typedef enum {
35 MSXML_DEFAULT = 0,
36 MSXML2 = 20,
37 MSXML26 = 26,
38 MSXML3 = 30,
39 MSXML4 = 40,
40 MSXML6 = 60
41 } MSXML_VERSION;
42
43 /* typelibs */
44 typedef enum tid_t {
45 NULL_tid,
46 IXMLDOMAttribute_tid,
47 IXMLDOMCDATASection_tid,
48 IXMLDOMComment_tid,
49 IXMLDOMDocument_tid,
50 IXMLDOMDocument2_tid,
51 IXMLDOMDocument3_tid,
52 IXMLDOMDocumentFragment_tid,
53 IXMLDOMDocumentType_tid,
54 IXMLDOMElement_tid,
55 IXMLDOMEntityReference_tid,
56 IXMLDOMImplementation_tid,
57 IXMLDOMNamedNodeMap_tid,
58 IXMLDOMNode_tid,
59 IXMLDOMNodeList_tid,
60 IXMLDOMParseError2_tid,
61 IXMLDOMProcessingInstruction_tid,
62 IXMLDOMSchemaCollection_tid,
63 IXMLDOMSchemaCollection2_tid,
64 IXMLDOMSelection_tid,
65 IXMLDOMText_tid,
66 IXMLElement_tid,
67 IXMLDocument_tid,
68 IXMLHTTPRequest_tid,
69 IXSLProcessor_tid,
70 IXSLTemplate_tid,
71 IVBSAXAttributes_tid,
72 IVBSAXContentHandler_tid,
73 IVBSAXDeclHandler_tid,
74 IVBSAXDTDHandler_tid,
75 IVBSAXEntityResolver_tid,
76 IVBSAXErrorHandler_tid,
77 IVBSAXLexicalHandler_tid,
78 IVBSAXLocator_tid,
79 IVBSAXXMLFilter_tid,
80 IVBSAXXMLReader_tid,
81 IMXAttributes_tid,
82 IMXReaderControl_tid,
83 IMXWriter_tid,
84 IVBMXNamespaceManager_tid,
85 IServerXMLHTTPRequest_tid,
86 LAST_tid
87 } tid_t;
88
89 /* The XDR datatypes (urn:schemas-microsoft-com:datatypes)
90 * These are actually valid for XSD schemas as well
91 * See datatypes.xsd
92 */
93 typedef enum _XDR_DT {
94 DT_INVALID = -1,
95 DT_BIN_BASE64,
96 DT_BIN_HEX,
97 DT_BOOLEAN,
98 DT_CHAR,
99 DT_DATE,
100 DT_DATE_TZ,
101 DT_DATETIME,
102 DT_DATETIME_TZ,
103 DT_ENTITY,
104 DT_ENTITIES,
105 DT_ENUMERATION,
106 DT_FIXED_14_4,
107 DT_FLOAT,
108 DT_I1,
109 DT_I2,
110 DT_I4,
111 DT_I8,
112 DT_ID,
113 DT_IDREF,
114 DT_IDREFS,
115 DT_INT,
116 DT_NMTOKEN,
117 DT_NMTOKENS,
118 DT_NOTATION,
119 DT_NUMBER,
120 DT_R4,
121 DT_R8,
122 DT_STRING,
123 DT_TIME,
124 DT_TIME_TZ,
125 DT_UI1,
126 DT_UI2,
127 DT_UI4,
128 DT_UI8,
129 DT_URI,
130 DT_UUID,
131 LAST_DT
132 } XDR_DT;
133
134 extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
135 extern void release_typelib(void) DECLSPEC_HIDDEN;
136
137 typedef struct dispex_data_t dispex_data_t;
138
139 typedef struct {
140 HRESULT (*get_dispid)(IUnknown*,BSTR,DWORD,DISPID*);
141 HRESULT (*invoke)(IUnknown*,DISPID,LCID,WORD,DISPPARAMS*,VARIANT*,EXCEPINFO*);
142 } dispex_static_data_vtbl_t;
143
144 typedef struct {
145 const dispex_static_data_vtbl_t *vtbl;
146 const tid_t disp_tid;
147 dispex_data_t *data;
148 const tid_t* const iface_tids;
149 } dispex_static_data_t;
150
151 typedef struct {
152 IDispatchEx IDispatchEx_iface;
153
154 IUnknown *outer;
155
156 dispex_static_data_t *data;
157 } DispatchEx;
158
159 extern HINSTANCE MSXML_hInstance DECLSPEC_HIDDEN;
160
161 void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*) DECLSPEC_HIDDEN;
162 void release_dispex(DispatchEx*) DECLSPEC_HIDDEN;
163 BOOL dispex_query_interface(DispatchEx*,REFIID,void**) DECLSPEC_HIDDEN;
164 const IID *get_riid_from_tid(enum tid_t tid) DECLSPEC_HIDDEN;
165
166 /* memory allocation functions */
167
168 static inline void* __WINE_ALLOC_SIZE(2) heap_realloc_zero(void *mem, size_t size)
169 {
170 return HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, mem, size);
171 }
172
173 static inline LPWSTR heap_strdupW(LPCWSTR str)
174 {
175 LPWSTR ret = NULL;
176
177 if(str) {
178 DWORD size;
179
180 size = (strlenW(str)+1)*sizeof(WCHAR);
181 ret = heap_alloc(size);
182 if(ret)
183 memcpy(ret, str, size);
184 }
185
186 return ret;
187 }
188
189 /* XSLProcessor parameter list */
190 struct xslprocessor_par
191 {
192 struct list entry;
193 BSTR name;
194 BSTR value;
195 };
196
197 struct xslprocessor_params
198 {
199 struct list list;
200 unsigned int count;
201 };
202
203 #ifdef HAVE_LIBXML2
204
205 extern void schemasInit(void) DECLSPEC_HIDDEN;
206 extern void schemasCleanup(void) DECLSPEC_HIDDEN;
207
208 #ifndef HAVE_XMLFIRSTELEMENTCHILD
209 static inline xmlNodePtr wine_xmlFirstElementChild(xmlNodePtr parent)
210 {
211 xmlNodePtr child;
212 for (child = parent->children; child != NULL; child = child->next)
213 if (child->type == XML_ELEMENT_NODE)
214 break;
215
216 return child;
217 }
218 #define xmlFirstElementChild wine_xmlFirstElementChild
219 #endif
220
221 /* IXMLDOMNode Internal Structure */
222 typedef struct _xmlnode
223 {
224 DispatchEx dispex;
225 IXMLDOMNode *iface;
226 IXMLDOMNode *parent;
227 xmlNodePtr node;
228 } xmlnode;
229
230 /* IXMLDOMNamedNodeMap custom function table */
231 struct nodemap_funcs
232 {
233 HRESULT (*get_named_item)(const xmlNodePtr,BSTR,IXMLDOMNode**);
234 HRESULT (*set_named_item)(xmlNodePtr,IXMLDOMNode*,IXMLDOMNode**);
235 HRESULT (*remove_named_item)(xmlNodePtr,BSTR,IXMLDOMNode**);
236 HRESULT (*get_item)(xmlNodePtr,LONG,IXMLDOMNode**);
237 HRESULT (*get_length)(xmlNodePtr,LONG*);
238 HRESULT (*get_qualified_item)(const xmlNodePtr,BSTR,BSTR,IXMLDOMNode**);
239 HRESULT (*remove_qualified_item)(xmlNodePtr,BSTR,BSTR,IXMLDOMNode**);
240 HRESULT (*next_node)(const xmlNodePtr,LONG*,IXMLDOMNode**);
241 };
242
243 /* used by IEnumVARIANT to access outer object items */
244 struct enumvariant_funcs
245 {
246 HRESULT (*get_item)(IUnknown*, LONG, VARIANT*);
247 HRESULT (*next)(IUnknown*);
248 };
249
250 /* constructors */
251 extern IUnknown *create_domdoc( xmlNodePtr ) DECLSPEC_HIDDEN;
252 extern IUnknown *create_xmldoc( void ) DECLSPEC_HIDDEN;
253 extern IXMLDOMNode *create_node( xmlNodePtr ) DECLSPEC_HIDDEN;
254 extern IUnknown *create_element( xmlNodePtr ) DECLSPEC_HIDDEN;
255 extern IUnknown *create_attribute( xmlNodePtr ) DECLSPEC_HIDDEN;
256 extern IUnknown *create_text( xmlNodePtr ) DECLSPEC_HIDDEN;
257 extern IUnknown *create_pi( xmlNodePtr ) DECLSPEC_HIDDEN;
258 extern IUnknown *create_comment( xmlNodePtr ) DECLSPEC_HIDDEN;
259 extern IUnknown *create_cdata( xmlNodePtr ) DECLSPEC_HIDDEN;
260 extern IXMLDOMNodeList *create_children_nodelist( xmlNodePtr ) DECLSPEC_HIDDEN;
261 extern IXMLDOMNamedNodeMap *create_nodemap( xmlNodePtr, const struct nodemap_funcs* ) DECLSPEC_HIDDEN;
262 extern IUnknown *create_doc_Implementation(void) DECLSPEC_HIDDEN;
263 extern IUnknown *create_doc_fragment( xmlNodePtr ) DECLSPEC_HIDDEN;
264 extern IUnknown *create_doc_entity_ref( xmlNodePtr ) DECLSPEC_HIDDEN;
265 extern IUnknown *create_doc_type( xmlNodePtr ) DECLSPEC_HIDDEN;
266 extern HRESULT create_selection( xmlNodePtr, xmlChar*, IXMLDOMNodeList** ) DECLSPEC_HIDDEN;
267 extern HRESULT create_enumvariant( IUnknown*, BOOL, const struct enumvariant_funcs*, IEnumVARIANT**) DECLSPEC_HIDDEN;
268
269 /* data accessors */
270 xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type ) DECLSPEC_HIDDEN;
271
272 /* helpers */
273 extern xmlChar *xmlChar_from_wchar( LPCWSTR str ) DECLSPEC_HIDDEN;
274
275 extern void xmldoc_init( xmlDocPtr doc, MSXML_VERSION version ) DECLSPEC_HIDDEN;
276 extern LONG xmldoc_add_ref( xmlDocPtr doc ) DECLSPEC_HIDDEN;
277 extern LONG xmldoc_release( xmlDocPtr doc ) DECLSPEC_HIDDEN;
278 extern LONG xmldoc_add_refs( xmlDocPtr doc, LONG refs ) DECLSPEC_HIDDEN;
279 extern LONG xmldoc_release_refs ( xmlDocPtr doc, LONG refs ) DECLSPEC_HIDDEN;
280 extern void xmlnode_add_ref(xmlNodePtr node) DECLSPEC_HIDDEN;
281 extern void xmlnode_release(xmlNodePtr node) DECLSPEC_HIDDEN;
282 extern int xmlnode_get_inst_cnt( xmlnode *node ) DECLSPEC_HIDDEN;
283 extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN;
284 extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN;
285 extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node) DECLSPEC_HIDDEN;
286 extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc) DECLSPEC_HIDDEN;
287
288 extern HRESULT XMLElement_create( xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN;
289
290 extern void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap) DECLSPEC_HIDDEN;
291 extern void wineXmlCallbackError(char const* caller, xmlErrorPtr err) DECLSPEC_HIDDEN;
292
293 #define LIBXML2_LOG_CALLBACK __WINE_PRINTF_ATTR(2,3)
294
295 #define LIBXML2_CALLBACK_TRACE(caller, msg, ap) \
296 wineXmlCallbackLog(#caller, XML_ERR_NONE, msg, ap)
297
298 #define LIBXML2_CALLBACK_WARN(caller, msg, ap) \
299 wineXmlCallbackLog(#caller, XML_ERR_WARNING, msg, ap)
300
301 #define LIBXML2_CALLBACK_ERR(caller, msg, ap) \
302 wineXmlCallbackLog(#caller, XML_ERR_ERROR, msg, ap)
303
304 #define LIBXML2_CALLBACK_SERROR(caller, err) wineXmlCallbackError(#caller, err)
305
306 extern BOOL is_preserving_whitespace(xmlNodePtr node) DECLSPEC_HIDDEN;
307 extern BOOL is_xpathmode(const xmlDocPtr doc) DECLSPEC_HIDDEN;
308 extern void set_xpathmode(xmlDocPtr doc, BOOL xpath) DECLSPEC_HIDDEN;
309
310 extern void init_xmlnode(xmlnode*,xmlNodePtr,IXMLDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
311 extern void destroy_xmlnode(xmlnode*) DECLSPEC_HIDDEN;
312 extern BOOL node_query_interface(xmlnode*,REFIID,void**) DECLSPEC_HIDDEN;
313 extern xmlnode *get_node_obj(IXMLDOMNode*) DECLSPEC_HIDDEN;
314
315 extern HRESULT node_append_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
316 extern HRESULT node_get_nodeName(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
317 extern HRESULT node_get_content(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
318 extern HRESULT node_set_content(xmlnode*,LPCWSTR) DECLSPEC_HIDDEN;
319 extern HRESULT node_put_value(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
320 extern HRESULT node_put_value_escaped(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
321 extern HRESULT node_get_parent(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
322 extern HRESULT node_get_child_nodes(xmlnode*,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
323 extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
324 extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
325 extern HRESULT node_get_previous_sibling(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
326 extern HRESULT node_get_next_sibling(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
327 extern HRESULT node_insert_before(xmlnode*,IXMLDOMNode*,const VARIANT*,IXMLDOMNode**) DECLSPEC_HIDDEN;
328 extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
329 extern HRESULT node_put_text(xmlnode*,BSTR) DECLSPEC_HIDDEN;
330 extern HRESULT node_get_xml(xmlnode*,BOOL,BSTR*) DECLSPEC_HIDDEN;
331 extern HRESULT node_clone(xmlnode*,VARIANT_BOOL,IXMLDOMNode**) DECLSPEC_HIDDEN;
332 extern HRESULT node_get_prefix(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
333 extern HRESULT node_get_base_name(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
334 extern HRESULT node_get_namespaceURI(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
335 extern HRESULT node_remove_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
336 extern HRESULT node_has_childnodes(const xmlnode*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
337 extern HRESULT node_get_owner_doc(const xmlnode*,IXMLDOMDocument**) DECLSPEC_HIDDEN;
338 extern HRESULT node_get_text(const xmlnode*,BSTR*) DECLSPEC_HIDDEN;
339 extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
340 extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**) DECLSPEC_HIDDEN;
341 extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
342 extern HRESULT node_transform_node_params(const xmlnode*,IXMLDOMNode*,BSTR*,ISequentialStream*,
343 const struct xslprocessor_params*) DECLSPEC_HIDDEN;
344 extern HRESULT node_create_supporterrorinfo(const tid_t*,void**) DECLSPEC_HIDDEN;
345
346 extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) DECLSPEC_HIDDEN;
347
348 extern HRESULT SchemaCache_validate_tree(IXMLDOMSchemaCollection2*, xmlNodePtr) DECLSPEC_HIDDEN;
349 extern XDR_DT SchemaCache_get_node_dt(IXMLDOMSchemaCollection2*, xmlNodePtr) DECLSPEC_HIDDEN;
350 extern HRESULT cache_from_doc_ns(IXMLDOMSchemaCollection2*, xmlnode*) DECLSPEC_HIDDEN;
351
352 extern XDR_DT str_to_dt(xmlChar const* str, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
353 extern XDR_DT bstr_to_dt(OLECHAR const* bstr, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
354 extern xmlChar const* dt_to_str(XDR_DT dt) DECLSPEC_HIDDEN;
355 extern const char* debugstr_dt(XDR_DT dt) DECLSPEC_HIDDEN;
356 extern OLECHAR const* dt_to_bstr(XDR_DT dt) DECLSPEC_HIDDEN;
357 extern HRESULT dt_validate(XDR_DT dt, xmlChar const* content) DECLSPEC_HIDDEN;
358
359 extern BSTR EnsureCorrectEOL(BSTR) DECLSPEC_HIDDEN;
360
361 extern xmlChar* tagName_to_XPath(const BSTR tagName) DECLSPEC_HIDDEN;
362
363 #ifdef SONAME_LIBXSLT
364 # include <libxslt/documents.h>
365 extern xmlDocPtr xslt_doc_default_loader(const xmlChar *uri, xmlDictPtr dict, int options,
366 void *_ctxt, xsltLoadType type) DECLSPEC_HIDDEN;
367 #endif /* SONAME_LIBXSLT */
368
369 static inline BSTR bstr_from_xmlChar(const xmlChar *str)
370 {
371 BSTR ret = NULL;
372
373 if(str) {
374 DWORD len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, NULL, 0);
375 ret = SysAllocStringLen(NULL, len-1);
376 if(ret)
377 MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)str, -1, ret, len);
378 }
379 else
380 ret = SysAllocStringLen(NULL, 0);
381
382 return ret;
383 }
384
385 static inline xmlChar *xmlchar_from_wcharn(const WCHAR *str, int nchars, BOOL use_xml_alloc)
386 {
387 xmlChar *xmlstr;
388 DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, nchars, NULL, 0, NULL, NULL );
389
390 xmlstr = use_xml_alloc ? xmlMalloc( len + 1 ) : heap_alloc( len + 1 );
391 if ( xmlstr )
392 {
393 WideCharToMultiByte( CP_UTF8, 0, str, nchars, (LPSTR) xmlstr, len+1, NULL, NULL );
394 xmlstr[len] = 0;
395 }
396 return xmlstr;
397 }
398
399 static inline xmlChar *xmlchar_from_wchar( const WCHAR *str )
400 {
401 return xmlchar_from_wcharn(str, -1, FALSE);
402 }
403
404 static inline xmlChar *heap_strdupxmlChar(const xmlChar *str)
405 {
406 xmlChar *ret = NULL;
407
408 if(str) {
409 DWORD size;
410
411 size = (xmlStrlen(str)+1)*sizeof(xmlChar);
412 ret = heap_alloc(size);
413 memcpy(ret, str, size);
414 }
415
416 return ret;
417 }
418
419 #endif
420
421 static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
422 {
423 if(!p)
424 return E_INVALIDARG;
425
426 if(value) {
427 *p = SysAllocString(value);
428 if(!*p)
429 return E_OUTOFMEMORY;
430 }else {
431 *p = NULL;
432 }
433
434 return S_OK;
435 }
436
437 static inline HRESULT return_bstrn(const WCHAR *value, int len, BSTR *p)
438 {
439 if(value) {
440 *p = SysAllocStringLen(value, len);
441 if(!*p)
442 return E_OUTOFMEMORY;
443 }else
444 *p = NULL;
445
446 return S_OK;
447 }
448
449 static inline HRESULT return_null_node(IXMLDOMNode **p)
450 {
451 if(!p)
452 return E_INVALIDARG;
453 *p = NULL;
454 return S_FALSE;
455 }
456
457 static inline HRESULT return_null_ptr(void **p)
458 {
459 if(!p)
460 return E_INVALIDARG;
461 *p = NULL;
462 return S_FALSE;
463 }
464
465 static inline HRESULT return_null_var(VARIANT *p)
466 {
467 if(!p)
468 return E_INVALIDARG;
469
470 V_VT(p) = VT_NULL;
471 return S_FALSE;
472 }
473
474 static inline HRESULT return_null_bstr(BSTR *p)
475 {
476 if(!p)
477 return E_INVALIDARG;
478
479 *p = NULL;
480 return S_FALSE;
481 }
482
483 static inline HRESULT return_var_false(VARIANT_BOOL *p)
484 {
485 if(!p)
486 return E_INVALIDARG;
487
488 *p = VARIANT_FALSE;
489 return S_FALSE;
490 }
491
492 extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
493 LONG line, LONG linepos, LONG filepos ) DECLSPEC_HIDDEN;
494 extern HRESULT DOMDocument_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
495 extern HRESULT SchemaCache_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
496 extern HRESULT XMLDocument_create(void**) DECLSPEC_HIDDEN;
497 extern HRESULT SAXXMLReader_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
498 extern HRESULT SAXAttributes_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
499 extern HRESULT XMLHTTPRequest_create(void **) DECLSPEC_HIDDEN;
500 extern HRESULT ServerXMLHTTP_create(void **) DECLSPEC_HIDDEN;
501 extern HRESULT XSLTemplate_create(void**) DECLSPEC_HIDDEN;
502 extern HRESULT MXWriter_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
503 extern HRESULT MXNamespaceManager_create(void**) DECLSPEC_HIDDEN;
504 extern HRESULT XMLParser_create(void**) DECLSPEC_HIDDEN;
505 extern HRESULT XMLView_create(void**) DECLSPEC_HIDDEN;
506
507 static inline const CLSID* DOMDocument_version(MSXML_VERSION v)
508 {
509 switch (v)
510 {
511 default:
512 case MSXML_DEFAULT: return &CLSID_DOMDocument;
513 case MSXML3: return &CLSID_DOMDocument30;
514 case MSXML4: return &CLSID_DOMDocument40;
515 case MSXML6: return &CLSID_DOMDocument60;
516 }
517 }
518
519 static inline const CLSID* SchemaCache_version(MSXML_VERSION v)
520 {
521 switch (v)
522 {
523 default:
524 case MSXML_DEFAULT: return &CLSID_XMLSchemaCache;
525 case MSXML3: return &CLSID_XMLSchemaCache30;
526 case MSXML4: return &CLSID_XMLSchemaCache40;
527 case MSXML6: return &CLSID_XMLSchemaCache60;
528 }
529 }
530
531 typedef struct bsc_t bsc_t;
532
533 HRESULT create_moniker_from_url(LPCWSTR, IMoniker**) DECLSPEC_HIDDEN;
534 HRESULT create_uri(const WCHAR *, IUri **) DECLSPEC_HIDDEN;
535 HRESULT bind_url(IMoniker*, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**) DECLSPEC_HIDDEN;
536 HRESULT detach_bsc(bsc_t*) DECLSPEC_HIDDEN;
537
538 /* Error Codes - not defined anywhere in the public headers */
539 #define E_XML_ELEMENT_UNDECLARED 0xC00CE00D
540 #define E_XML_ELEMENT_ID_NOT_FOUND 0xC00CE00E
541 /* ... */
542 #define E_XML_EMPTY_NOT_ALLOWED 0xC00CE011
543 #define E_XML_ELEMENT_NOT_COMPLETE 0xC00CE012
544 #define E_XML_ROOT_NAME_MISMATCH 0xC00CE013
545 #define E_XML_INVALID_CONTENT 0xC00CE014
546 #define E_XML_ATTRIBUTE_NOT_DEFINED 0xC00CE015
547 #define E_XML_ATTRIBUTE_FIXED 0xC00CE016
548 #define E_XML_ATTRIBUTE_VALUE 0xC00CE017
549 #define E_XML_ILLEGAL_TEXT 0xC00CE018
550 /* ... */
551 #define E_XML_REQUIRED_ATTRIBUTE_MISSING 0xC00CE020
552
553 #define NODE_PRIV_TRAILING_IGNORABLE_WS 0x40000000
554 #define NODE_PRIV_CHILD_IGNORABLE_WS 0x80000000
555 #define NODE_PRIV_REFCOUNT_MASK ~(NODE_PRIV_TRAILING_IGNORABLE_WS|NODE_PRIV_CHILD_IGNORABLE_WS)
556 #endif /* __MSXML_PRIVATE__ */