Click to See Complete Forum and Search --> : how to use XmlDocument in C++?


quekky
December 1st, 2002, 10:28 PM
#using <System.Xml.dll>
using namespace System::Xml;

namespace abc {
class abc
{
virtual XmlDocument* GetXmlDocument(CFile file);
}}
have error:
d:\Visual Studio Projects\abc\abc.h(85): error C3383: abc::abc::GetXmlDocument' : in an unmanaged class, a virtual member function cannot have a managed type in the signature


how do i create and use an XmlDocument. Regex and other .net functions in C++? specifically, i wanna use these functions in emule

mkamal
December 2nd, 2002, 03:53 PM
Hi
If you paste this code in a new C++ Managed Application Project
it will show you the name of the of the first Node.
Good Luck.
Kamal

// This is the main project file for VC++ application project
// generated using an Application Wizard.

#include "stdafx.h"

#using <mscorlib.dll>
#include <tchar.h>

#using <System.dll>
#using <System.xml.dll>

using namespace System;
using namespace System::Xml;

__gc class CXMLReader
{
public:
XmlDocument* GetXmlDocument(String* fileName);
};

XmlDocument* CXMLReader::GetXmlDocument(String* fileName) //fileName must include fully qualified path
{
XmlDocument* doc = new XmlDocument();
doc->Load(fileName);
return doc;
}


// This is the entry point for this application
int _tmain(void)
{
// TODO: Please replace the sample code below with your own.
CXMLReader* rdr = new CXMLReader();
XmlDocument* doc = rdr->GetXmlDocument(S"D:\\VC++ Projects\\Test1\\test1.xml");

Console::WriteLine(doc->FirstChild->Name);

return 0;
}

quekky
December 4th, 2002, 02:41 AM
Originally posted by mkamal
Hi
If you paste this code in a new C++ Managed Application Project
it will show you the name of the of the first Node.
Good Luck.
Kamal

thanks, but i wanted to use XmlDocument in emule, which is a unmanaged project. converting it to managed will be a ****