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