msxml_private.h 18.2 KB
Newer Older
1
/*
2
 *    Common definitions
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * 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
18
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 20 21 22 23
 */

#ifndef __MSXML_PRIVATE__
#define __MSXML_PRIVATE__

24 25 26
#include "dispex.h"

#include "wine/unicode.h"
27
#include "wine/heap.h"
28
#include "wine/list.h"
29

30 31 32 33
#ifndef __WINE_CONFIG_H
# error You must include config.h to use this header
#endif

34 35
typedef enum {
    MSXML_DEFAULT = 0,
36 37 38 39 40
    MSXML2        = 20,
    MSXML26       = 26,
    MSXML3        = 30,
    MSXML4        = 40,
    MSXML6        = 60
41 42
} MSXML_VERSION;

43 44
/* typelibs */
typedef enum tid_t {
45
    NULL_tid,
46 47 48 49 50
    IXMLDOMAttribute_tid,
    IXMLDOMCDATASection_tid,
    IXMLDOMComment_tid,
    IXMLDOMDocument_tid,
    IXMLDOMDocument2_tid,
51
    IXMLDOMDocument3_tid,
52
    IXMLDOMDocumentFragment_tid,
53
    IXMLDOMDocumentType_tid,
54 55 56 57 58 59
    IXMLDOMElement_tid,
    IXMLDOMEntityReference_tid,
    IXMLDOMImplementation_tid,
    IXMLDOMNamedNodeMap_tid,
    IXMLDOMNode_tid,
    IXMLDOMNodeList_tid,
60
    IXMLDOMParseError2_tid,
61 62
    IXMLDOMProcessingInstruction_tid,
    IXMLDOMSchemaCollection_tid,
63
    IXMLDOMSchemaCollection2_tid,
64
    IXMLDOMSelection_tid,
65 66 67 68
    IXMLDOMText_tid,
    IXMLElement_tid,
    IXMLDocument_tid,
    IXMLHTTPRequest_tid,
69
    IXSLProcessor_tid,
70
    IXSLTemplate_tid,
71 72 73 74 75 76 77 78 79 80 81 82 83
    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,
84
    IVBMXNamespaceManager_tid,
85
    IServerXMLHTTPRequest_tid,
86 87 88
    LAST_tid
} tid_t;

89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
/* The XDR datatypes (urn:schemas-microsoft-com:datatypes)
 * These are actually valid for XSD schemas as well
 * See datatypes.xsd
 */
typedef enum _XDR_DT {
    DT_INVALID = -1,
    DT_BIN_BASE64,
    DT_BIN_HEX,
    DT_BOOLEAN,
    DT_CHAR,
    DT_DATE,
    DT_DATE_TZ,
    DT_DATETIME,
    DT_DATETIME_TZ,
    DT_ENTITY,
    DT_ENTITIES,
    DT_ENUMERATION,
    DT_FIXED_14_4,
    DT_FLOAT,
    DT_I1,
    DT_I2,
    DT_I4,
    DT_I8,
    DT_ID,
    DT_IDREF,
    DT_IDREFS,
    DT_INT,
    DT_NMTOKEN,
    DT_NMTOKENS,
    DT_NOTATION,
    DT_NUMBER,
    DT_R4,
    DT_R8,
    DT_STRING,
    DT_TIME,
    DT_TIME_TZ,
    DT_UI1,
    DT_UI2,
    DT_UI4,
    DT_UI8,
    DT_URI,
130 131
    DT_UUID,
    LAST_DT
132 133
} XDR_DT;

134 135
extern HRESULT get_typeinfo(tid_t tid, ITypeInfo **typeinfo) DECLSPEC_HIDDEN;
extern void release_typelib(void) DECLSPEC_HIDDEN;
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151

typedef struct dispex_data_t dispex_data_t;

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 {
152
    IDispatchEx IDispatchEx_iface;
153 154 155 156 157 158

    IUnknown *outer;

    dispex_static_data_t *data;
} DispatchEx;

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 167
/* memory allocation functions */

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 174 175 176 177 178 179 180 181
static inline LPWSTR heap_strdupW(LPCWSTR str)
{
    LPWSTR ret = NULL;

    if(str) {
        DWORD size;

        size = (strlenW(str)+1)*sizeof(WCHAR);
        ret = heap_alloc(size);
182 183
        if(ret)
            memcpy(ret, str, size);
184 185 186 187 188
    }

    return ret;
}

189 190 191 192 193 194 195 196 197 198 199 200 201 202
/* XSLProcessor parameter list */
struct xslprocessor_par
{
    struct list entry;
    BSTR name;
    BSTR value;
};

struct xslprocessor_params
{
    struct list  list;
    unsigned int count;
};

203 204
#ifdef HAVE_LIBXML2

205 206
extern void schemasInit(void) DECLSPEC_HIDDEN;
extern void schemasCleanup(void) DECLSPEC_HIDDEN;
207

208
#ifndef HAVE_XMLFIRSTELEMENTCHILD
209 210
static inline xmlNodePtr wine_xmlFirstElementChild(xmlNodePtr parent)
{
211 212 213 214 215 216 217
    xmlNodePtr child;
    for (child = parent->children; child != NULL; child = child->next)
        if (child->type == XML_ELEMENT_NODE)
            break;

    return child;
}
218
#define xmlFirstElementChild wine_xmlFirstElementChild
219 220
#endif

221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
/* IXMLDOMNode Internal Structure */
typedef struct _xmlnode
{
    DispatchEx   dispex;
    IXMLDOMNode *iface;
    IXMLDOMNode *parent;
    xmlNodePtr   node;
} xmlnode;

/* IXMLDOMNamedNodeMap custom function table */
struct nodemap_funcs
{
    HRESULT (*get_named_item)(const xmlNodePtr,BSTR,IXMLDOMNode**);
    HRESULT (*set_named_item)(xmlNodePtr,IXMLDOMNode*,IXMLDOMNode**);
    HRESULT (*remove_named_item)(xmlNodePtr,BSTR,IXMLDOMNode**);
    HRESULT (*get_item)(xmlNodePtr,LONG,IXMLDOMNode**);
    HRESULT (*get_length)(xmlNodePtr,LONG*);
    HRESULT (*get_qualified_item)(const xmlNodePtr,BSTR,BSTR,IXMLDOMNode**);
    HRESULT (*remove_qualified_item)(xmlNodePtr,BSTR,BSTR,IXMLDOMNode**);
    HRESULT (*next_node)(const xmlNodePtr,LONG*,IXMLDOMNode**);
};

243 244 245
/* used by IEnumVARIANT to access outer object items */
struct enumvariant_funcs
{
246
    HRESULT (*get_item)(IUnknown*, LONG, VARIANT*);
247 248 249
    HRESULT (*next)(IUnknown*);
};

250
/* constructors */
251 252 253 254
extern IUnknown         *create_domdoc( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown         *create_xmldoc( void ) DECLSPEC_HIDDEN;
extern IXMLDOMNode      *create_node( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown         *create_element( xmlNodePtr ) DECLSPEC_HIDDEN;
255
extern IUnknown         *create_attribute( xmlNodePtr, BOOL ) DECLSPEC_HIDDEN;
256 257 258 259 260
extern IUnknown         *create_text( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown         *create_pi( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown         *create_comment( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown         *create_cdata( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IXMLDOMNodeList  *create_children_nodelist( xmlNodePtr ) DECLSPEC_HIDDEN;
261
extern IXMLDOMNamedNodeMap *create_nodemap( xmlNodePtr, const struct nodemap_funcs* ) DECLSPEC_HIDDEN;
262 263 264 265 266
extern IUnknown         *create_doc_Implementation(void) DECLSPEC_HIDDEN;
extern IUnknown         *create_doc_fragment( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown         *create_doc_entity_ref( xmlNodePtr ) DECLSPEC_HIDDEN;
extern IUnknown         *create_doc_type( xmlNodePtr ) DECLSPEC_HIDDEN;
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 277
extern LONG xmldoc_add_ref( xmlDocPtr doc ) DECLSPEC_HIDDEN;
extern LONG xmldoc_release( xmlDocPtr doc ) DECLSPEC_HIDDEN;
278 279
extern LONG xmldoc_add_refs( xmlDocPtr doc, LONG refs ) DECLSPEC_HIDDEN;
extern LONG xmldoc_release_refs ( xmlDocPtr doc, LONG refs ) DECLSPEC_HIDDEN;
280 281
extern void xmlnode_add_ref(xmlNodePtr node) DECLSPEC_HIDDEN;
extern void xmlnode_release(xmlNodePtr node) DECLSPEC_HIDDEN;
282
extern int xmlnode_get_inst_cnt( xmlnode *node ) DECLSPEC_HIDDEN;
283 284 285 286
extern HRESULT xmldoc_add_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN;
extern HRESULT xmldoc_remove_orphan( xmlDocPtr doc, xmlNodePtr node ) DECLSPEC_HIDDEN;
extern void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node) DECLSPEC_HIDDEN;
extern xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc) DECLSPEC_HIDDEN;
287
extern MSXML_VERSION xmldoc_version( xmlDocPtr doc ) DECLSPEC_HIDDEN;
288

289
extern HRESULT XMLElement_create( xmlNodePtr node, LPVOID *ppObj, BOOL own ) DECLSPEC_HIDDEN;
290

291 292
extern void wineXmlCallbackLog(char const* caller, xmlErrorLevel lvl, char const* msg, va_list ap) DECLSPEC_HIDDEN;
extern void wineXmlCallbackError(char const* caller, xmlErrorPtr err) DECLSPEC_HIDDEN;
293 294 295 296 297 298 299 300 301 302 303 304

#define LIBXML2_LOG_CALLBACK __WINE_PRINTF_ATTR(2,3)

#define LIBXML2_CALLBACK_TRACE(caller, msg, ap) \
        wineXmlCallbackLog(#caller, XML_ERR_NONE, msg, ap)

#define LIBXML2_CALLBACK_WARN(caller, msg, ap) \
        wineXmlCallbackLog(#caller, XML_ERR_WARNING, msg, ap)

#define LIBXML2_CALLBACK_ERR(caller, msg, ap) \
        wineXmlCallbackLog(#caller, XML_ERR_ERROR, msg, ap)

305
#define LIBXML2_CALLBACK_SERROR(caller, err) wineXmlCallbackError(#caller, err)
306

307 308 309
extern BOOL is_preserving_whitespace(xmlNodePtr node) DECLSPEC_HIDDEN;
extern BOOL is_xpathmode(const xmlDocPtr doc) DECLSPEC_HIDDEN;
extern void set_xpathmode(xmlDocPtr doc, BOOL xpath) DECLSPEC_HIDDEN;
310

311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330
extern void init_xmlnode(xmlnode*,xmlNodePtr,IXMLDOMNode*,dispex_static_data_t*) DECLSPEC_HIDDEN;
extern void destroy_xmlnode(xmlnode*) DECLSPEC_HIDDEN;
extern BOOL node_query_interface(xmlnode*,REFIID,void**) DECLSPEC_HIDDEN;
extern xmlnode *get_node_obj(IXMLDOMNode*) DECLSPEC_HIDDEN;

extern HRESULT node_append_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_nodeName(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_get_content(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
extern HRESULT node_set_content(xmlnode*,LPCWSTR) DECLSPEC_HIDDEN;
extern HRESULT node_put_value(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
extern HRESULT node_put_value_escaped(xmlnode*,VARIANT*) DECLSPEC_HIDDEN;
extern HRESULT node_get_parent(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_child_nodes(xmlnode*,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
extern HRESULT node_get_first_child(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_last_child(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_previous_sibling(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_next_sibling(xmlnode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_insert_before(xmlnode*,IXMLDOMNode*,const VARIANT*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_put_text(xmlnode*,BSTR) DECLSPEC_HIDDEN;
331
extern HRESULT node_get_xml(xmlnode*,BOOL,BSTR*) DECLSPEC_HIDDEN;
332 333 334 335 336 337 338 339 340 341 342
extern HRESULT node_clone(xmlnode*,VARIANT_BOOL,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_get_prefix(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_get_base_name(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_get_namespaceURI(xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_remove_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_has_childnodes(const xmlnode*,VARIANT_BOOL*) DECLSPEC_HIDDEN;
extern HRESULT node_get_owner_doc(const xmlnode*,IXMLDOMDocument**) DECLSPEC_HIDDEN;
extern HRESULT node_get_text(const xmlnode*,BSTR*) DECLSPEC_HIDDEN;
extern HRESULT node_select_nodes(const xmlnode*,BSTR,IXMLDOMNodeList**) DECLSPEC_HIDDEN;
extern HRESULT node_select_singlenode(const xmlnode*,BSTR,IXMLDOMNode**) DECLSPEC_HIDDEN;
extern HRESULT node_transform_node(const xmlnode*,IXMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
343 344
extern HRESULT node_transform_node_params(const xmlnode*,IXMLDOMNode*,BSTR*,ISequentialStream*,
    const struct xslprocessor_params*) DECLSPEC_HIDDEN;
345
extern HRESULT node_create_supporterrorinfo(const tid_t*,void**) DECLSPEC_HIDDEN;
346 347 348

extern HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document) DECLSPEC_HIDDEN;

349 350 351
extern HRESULT SchemaCache_validate_tree(IXMLDOMSchemaCollection2*, xmlNodePtr) DECLSPEC_HIDDEN;
extern XDR_DT  SchemaCache_get_node_dt(IXMLDOMSchemaCollection2*, xmlNodePtr) DECLSPEC_HIDDEN;
extern HRESULT cache_from_doc_ns(IXMLDOMSchemaCollection2*, xmlnode*) DECLSPEC_HIDDEN;
352 353 354 355

extern XDR_DT str_to_dt(xmlChar const* str, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
extern XDR_DT bstr_to_dt(OLECHAR const* bstr, int len /* calculated if -1 */) DECLSPEC_HIDDEN;
extern xmlChar const* dt_to_str(XDR_DT dt) DECLSPEC_HIDDEN;
356
extern const char* debugstr_dt(XDR_DT dt) DECLSPEC_HIDDEN;
357 358 359 360 361 362
extern OLECHAR const* dt_to_bstr(XDR_DT dt) DECLSPEC_HIDDEN;
extern HRESULT dt_validate(XDR_DT dt, xmlChar const* content) DECLSPEC_HIDDEN;

extern BSTR EnsureCorrectEOL(BSTR) DECLSPEC_HIDDEN;

extern xmlChar* tagName_to_XPath(const BSTR tagName) DECLSPEC_HIDDEN;
363

364 365 366 367 368 369
#ifdef SONAME_LIBXSLT
#  include <libxslt/documents.h>
extern xmlDocPtr xslt_doc_default_loader(const xmlChar *uri, xmlDictPtr dict, int options,
    void *_ctxt, xsltLoadType type) DECLSPEC_HIDDEN;
#endif /* SONAME_LIBXSLT */

370 371 372 373 374 375 376 377 378 379
static inline BSTR bstr_from_xmlChar(const xmlChar *str)
{
    BSTR ret = NULL;

    if(str) {
        DWORD len = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)str, -1, NULL, 0);
        ret = SysAllocStringLen(NULL, len-1);
        if(ret)
            MultiByteToWideChar( CP_UTF8, 0, (LPCSTR)str, -1, ret, len);
    }
380 381
    else
        ret = SysAllocStringLen(NULL, 0);
382 383 384 385

    return ret;
}

386
static inline xmlChar *xmlchar_from_wcharn(const WCHAR *str, int nchars, BOOL use_xml_alloc)
387 388 389 390
{
    xmlChar *xmlstr;
    DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, nchars, NULL, 0, NULL, NULL );

391
    xmlstr = use_xml_alloc ? xmlMalloc( len + 1 ) : heap_alloc( len + 1 );
392 393 394 395 396 397 398 399 400 401
    if ( xmlstr )
    {
        WideCharToMultiByte( CP_UTF8, 0, str, nchars, (LPSTR) xmlstr, len+1, NULL, NULL );
        xmlstr[len] = 0;
    }
    return xmlstr;
}

static inline xmlChar *xmlchar_from_wchar( const WCHAR *str )
{
402
    return xmlchar_from_wcharn(str, -1, FALSE);
403 404
}

405 406 407 408 409 410 411 412 413 414 415 416 417 418 419
static inline xmlChar *heap_strdupxmlChar(const xmlChar *str)
{
    xmlChar *ret = NULL;

    if(str) {
        DWORD size;

        size = (xmlStrlen(str)+1)*sizeof(xmlChar);
        ret = heap_alloc(size);
        memcpy(ret, str, size);
    }

    return ret;
}

420 421
#endif

422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
{
    if(!p)
        return E_INVALIDARG;

    if(value) {
        *p = SysAllocString(value);
        if(!*p)
            return E_OUTOFMEMORY;
    }else {
        *p = NULL;
    }

    return S_OK;
}

438 439 440 441 442 443 444 445 446 447 448 449
static inline HRESULT return_bstrn(const WCHAR *value, int len, BSTR *p)
{
    if(value) {
        *p = SysAllocStringLen(value, len);
        if(!*p)
            return E_OUTOFMEMORY;
    }else
        *p = NULL;

    return S_OK;
}

450 451 452 453 454 455 456 457
static inline HRESULT return_null_node(IXMLDOMNode **p)
{
    if(!p)
        return E_INVALIDARG;
    *p = NULL;
    return S_FALSE;
}

458 459 460 461 462 463 464 465
static inline HRESULT return_null_ptr(void **p)
{
    if(!p)
        return E_INVALIDARG;
    *p = NULL;
    return S_FALSE;
}

466 467 468 469 470 471 472 473 474
static inline HRESULT return_null_var(VARIANT *p)
{
    if(!p)
        return E_INVALIDARG;

    V_VT(p) = VT_NULL;
    return S_FALSE;
}

475 476 477 478 479 480 481 482 483
static inline HRESULT return_null_bstr(BSTR *p)
{
    if(!p)
        return E_INVALIDARG;

    *p = NULL;
    return S_FALSE;
}

484 485 486 487 488 489 490 491 492
static inline HRESULT return_var_false(VARIANT_BOOL *p)
{
    if(!p)
        return E_INVALIDARG;

    *p = VARIANT_FALSE;
    return S_FALSE;
}

493
extern IXMLDOMParseError *create_parseError( LONG code, BSTR url, BSTR reason, BSTR srcText,
494
                                             LONG line, LONG linepos, LONG filepos ) DECLSPEC_HIDDEN;
495 496 497 498 499 500 501 502 503 504 505 506
extern HRESULT DOMDocument_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT SchemaCache_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT XMLDocument_create(void**) DECLSPEC_HIDDEN;
extern HRESULT SAXXMLReader_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT SAXAttributes_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT XMLHTTPRequest_create(void **) DECLSPEC_HIDDEN;
extern HRESULT ServerXMLHTTP_create(void **) DECLSPEC_HIDDEN;
extern HRESULT XSLTemplate_create(void**) DECLSPEC_HIDDEN;
extern HRESULT MXWriter_create(MSXML_VERSION, void**) DECLSPEC_HIDDEN;
extern HRESULT MXNamespaceManager_create(void**) DECLSPEC_HIDDEN;
extern HRESULT XMLParser_create(void**) DECLSPEC_HIDDEN;
extern HRESULT XMLView_create(void**) DECLSPEC_HIDDEN;
507

508
static inline const CLSID* DOMDocument_version(MSXML_VERSION v)
509 510 511
{
    switch (v)
    {
512 513 514 515 516
    default:
    case MSXML_DEFAULT: return &CLSID_DOMDocument;
    case MSXML3: return &CLSID_DOMDocument30;
    case MSXML4: return &CLSID_DOMDocument40;
    case MSXML6: return &CLSID_DOMDocument60;
517 518 519
    }
}

520
static inline const CLSID* SchemaCache_version(MSXML_VERSION v)
521 522 523
{
    switch (v)
    {
524 525 526 527 528
    default:
    case MSXML_DEFAULT: return &CLSID_XMLSchemaCache;
    case MSXML3: return &CLSID_XMLSchemaCache30;
    case MSXML4: return &CLSID_XMLSchemaCache40;
    case MSXML6: return &CLSID_XMLSchemaCache60;
529 530 531
    }
}

532 533
typedef struct bsc_t bsc_t;

534
HRESULT create_moniker_from_url(LPCWSTR, IMoniker**) DECLSPEC_HIDDEN;
535
HRESULT create_uri(const WCHAR *, IUri **) DECLSPEC_HIDDEN;
536
HRESULT bind_url(IMoniker*, HRESULT (*onDataAvailable)(void*,char*,DWORD), void*, bsc_t**) DECLSPEC_HIDDEN;
537
HRESULT detach_bsc(bsc_t*) DECLSPEC_HIDDEN;
538

539 540 541 542 543 544 545 546 547 548 549 550 551 552 553
/* Error Codes - not defined anywhere in the public headers */
#define E_XML_ELEMENT_UNDECLARED            0xC00CE00D
#define E_XML_ELEMENT_ID_NOT_FOUND          0xC00CE00E
/* ... */
#define E_XML_EMPTY_NOT_ALLOWED             0xC00CE011
#define E_XML_ELEMENT_NOT_COMPLETE          0xC00CE012
#define E_XML_ROOT_NAME_MISMATCH            0xC00CE013
#define E_XML_INVALID_CONTENT               0xC00CE014
#define E_XML_ATTRIBUTE_NOT_DEFINED         0xC00CE015
#define E_XML_ATTRIBUTE_FIXED               0xC00CE016
#define E_XML_ATTRIBUTE_VALUE               0xC00CE017
#define E_XML_ILLEGAL_TEXT                  0xC00CE018
/* ... */
#define E_XML_REQUIRED_ATTRIBUTE_MISSING    0xC00CE020

554 555 556
#define NODE_PRIV_TRAILING_IGNORABLE_WS     0x40000000
#define NODE_PRIV_CHILD_IGNORABLE_WS        0x80000000
#define NODE_PRIV_REFCOUNT_MASK             ~(NODE_PRIV_TRAILING_IGNORABLE_WS|NODE_PRIV_CHILD_IGNORABLE_WS)
557
#endif /* __MSXML_PRIVATE__ */