IE50 - XML Examples
Sung Nguyen
Sung_Nguyen at datacard.com
Mon Nov 16 23:35:04 GMT 1998
Hi all:
OK - I am using NT4.0 - why I have to include F:\SBN\include\NT50
in order to run some examples (Microsoft C++ XML parser) ????
If I don't include NT50 header files, I got following errors:
F:\SBN\Include\shellapi.h(682) : error C2501: 'DWORD_PTR' : missing
decl-specifiers
F:\SBN\Include\shellapi.h(682) : error C2239: unexpected token
'__stdcall' following declaration of 'DWORD_PTR'
F:\SBN\Include\shellapi.h(682) : error C2059: syntax error :
'__stdcall'
F:\SBN\Include\shellapi.h(683) : error C2501: 'DWORD_PTR' : missing
decl-specifiers
F:\SBN\Include\shellapi.h(683) : error C2239: unexpected token
'__stdcall' following declaration of 'DWORD_PTR'
F:\SBN\Include\shellapi.h(683) : error C2059: syntax error :
'__stdcall'
F:\SBN\Include\prsht.h(356) : error C2501: 'INT_PTR' : missing
decl-specifiers
F:\SBN\Include\prsht.h(356) : error C2239: unexpected token
'__stdcall' following declaration of 'INT_PTR'
F:\SBN\Include\prsht.h(356) : error C2059: syntax error : '__stdcall'
F:\SBN\Include\prsht.h(357) : error C2501: 'INT_PTR' : missing
decl-specifiers
F:\SBN\Include\prsht.h(357) : error C2239: unexpected token
'__stdcall' following declaration of 'INT_PTR'
F:\SBN\Include\prsht.h(357) : error C2059: syntax error : '__stdcall'
Error executing cl.exe.
If I included NT50 both headers and libs: I got the link error:
Linking...
F:\SBN\Lib\NT50\ole32.lib : fatal error LNK1106: invalid file or disk
full: cannot seek to 0x360de508
Error executing link.exe.
sample2.exe - 1 error(s), 0 warning(s)
------------------------------------------------------
I don't know if someone out there can get these examples running???
Please give me some hints,
Please, don't tell me that in order to run these Microsoft examples I
need to install NT5.0 beta.
Regards and Thanks
SeanNg
______________________________ Reply Separator
_________________________________
Subject: RE: IE50 - XML Examples
Author: Chris Lovett <clovett at microsoft.com> at Internet
Date: 11/7/98 8:34 PM
You need the IE5 SDK which you can download from:
http://www.microsoft.com/gallery/samples/download/first.htm
-----Original Message-----
From: Sung_Nguyen at datacard.com [mailto:Sung_Nguyen at datacard.com]
Sent: Friday, November 06, 1998 6:10 PM
To: Tyler Baker; Fernando Cabral
Cc: Tim Bray; len bullard; xml-dev at ic.ac.uk; Barclay Rockwood
Subject: IE50 - XML Examples
Hi all:
I have trouble with linking the following example (downloaded from
MicroSoft site)
This is the link error I got:
"G:\mssdk\lib\ole32.lib : fatal error LNK1106: invalid file or disk
full: cannot seek to 0x35cb1cf1"
The two files: "mshtml.h" msxml.h" I got from Internet SDK with IE4.0
I don't know if they are still compatible with IE5.0 and where I can
get new "mshtml.h" msxml.h" for IE5.0.
Please point me the direction,
Thanks a lot,
SeanN
--------------------------------------
//////////////////////////////////////////////////////////////////////
//////
// Sample1.cxx: XML Object Model Sample 1
//--------------------------------------------------------------------
------
// Copyright (c) 1998 Microsoft Corporation. All Rights Reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//--------------------------------------------------------------------
------
//////////////////////////////////////////////////////////////////////
//////
#include <windows.h>
#include <windowsx.h>
#include <stdlib.h>
#include <stdio.h>
#include <io.h>
#include <hlink.h>
#include <dispex.h>
#include "mshtml.h"
#include "msxml.h"
#include <winnls.h>
#define CHECKHR(x) hr = x; if (FAILED(hr)) goto Cleanup;
#define SAFERELEASE(p) if (p) {(p)->Release(); p = NULL;} else ;
//////////////////////////////////////////////////////////////////////
//////
// Synopsis: Create an IXMLElement of type t
//////////////////////////////////////////////////////////////////////
//////
IXMLElement* CreateXMLElement(IXMLDocument* pDoc, XMLELEM_TYPE t)
{
IXMLElement* e;
VARIANT type;
type.vt = VT_I4;
V_I4(&type) = t;
VARIANT name;
name.vt = VT_BSTR;
V_BSTR(&name) = ::SysAllocString(L"ElementNode");
HRESULT hr = pDoc->createElement(type, name, &e);
::SysFreeString(V_BSTR(&name));
return e;
}
//////////////////////////////////////////////////////////////////////
//////
// Synopsis: Create an XML Document from Scratch in memory
//////////////////////////////////////////////////////////////////////
//////
HRESULT MemDocument()
{
IXMLDocument *pDoc = NULL;
IStream *pStm = NULL;
IPersistStreamInit *pPSI = NULL;
IXMLElement *enode = NULL, *el = NULL;
IXMLElement *root = NULL;
LARGE_INTEGER li = {0, 0};
HRESULT hr = S_OK;
int i, j;
// Create an empty XML document
CHECKHR(CoCreateInstance(CLSID_XMLDocument, NULL,
CLSCTX_INPROC_SERVER,
IID_IXMLDocument, (void**)&pDoc));
// Query the IPersistStreamInit interface
CHECKHR(pDoc->QueryInterface(IID_IPersistStreamInit, (void
**)&pPSI));
// Create an IStream
CHECKHR(CreateStreamOnHGlobal(NULL, TRUE, &pStm));
pStm->AddRef();
//
// Create an xml document with a root element
//
ULONG ulWritten;
CHECKHR(pStm->Write("<root/>", strlen("<root/>"), &ulWritten));
// load the xml document
CHECKHR(pStm->Seek(li, STREAM_SEEK_SET, NULL));
CHECKHR(pPSI->Load(pStm));
// get root element
CHECKHR(pDoc->get_root(&root));
//
// Create an xml document in memory
//
for (i = 10; i > 0; i--)
{
enode = CreateXMLElement(pDoc, XMLELEMTYPE_ELEMENT);
CHECKHR(root->addChild(enode, -1, -1));
for (j = 10; j > 0; j--)
{
el = CreateXMLElement(pDoc, XMLELEMTYPE_ELEMENT);
CHECKHR(enode->addChild(el, -1, -1));
SAFERELEASE(el);
}
SAFERELEASE(enode);
}
CHECKHR(pStm->Seek(li, STREAM_SEEK_SET, NULL));
CHECKHR(pPSI->Save(pStm, TRUE));
//
// Load the document from the in-memory stream
//
CHECKHR(pStm->Seek(li, STREAM_SEEK_SET, NULL));
CHECKHR(pPSI->Load(pStm));
Cleanup:
SAFERELEASE(root);
SAFERELEASE(el);
SAFERELEASE(enode);
SAFERELEASE(pPSI);
SAFERELEASE(pStm);
SAFERELEASE(pDoc);
return hr;
}
int _cdecl
main(int argc, char *argv[])
{
HRESULT hr = S_OK;
CoInitialize(NULL);
hr = MemDocument();
CoUninitialize();
return hr == 0 ? 0 : 1;
}
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following
message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list