CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Posts
    2

    how to use XmlDocument in C++?

    Code:
    #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

  2. #2
    Join Date
    Nov 2002
    Posts
    3
    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;
    }

  3. #3
    Join Date
    Dec 2002
    Posts
    2
    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 ****

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured