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