Hello to all.
I need to handle creating and loading/parsing of xml documents. I'm using c++ and other languages don't seem to be an option at this point.
Currently I've implemented this using msxml, but I must admit, this COM business seems whacko (I'm fairly new to c++ and this is my first experience with COM).
I would like to know if there is any good alternatives for handling xml than this COM business. If not, then any help with the situation noted below would be greatly appreciated.
I've used the following to get running.
I'm almost certain that I had to do something else to get rid of a "SDK doesn't support DCOM" or something like that, but I can't remember.
I'm using a private class member to hold the pointer to the xml doc.
CComPtr<MSXML::IXMLDOMDocument2> pDocument;
I use the following to initialize com and create the instance.
I have a two step process where I will open a project (above), and then (in a later thread) initialize it (below).
The init code above is the first interaction with the document in this new thread. At this point the program hangs and after a couple seconds crashes. My feeling is that the COM context is getting messed up between threads because if I call Both "OPen" and "Init" in the same thread the code (seemingly) works.
I'm an experienced programmer but quite novice in c++ so any information is helpful and appreciated.
Thanks.
I need to handle creating and loading/parsing of xml documents. I'm using c++ and other languages don't seem to be an option at this point.
Currently I've implemented this using msxml, but I must admit, this COM business seems whacko (I'm fairly new to c++ and this is my first experience with COM).
I would like to know if there is any good alternatives for handling xml than this COM business. If not, then any help with the situation noted below would be greatly appreciated.
I've used the following to get running.
- Code:
namespace MSXML
{
#include <msxml.h>
}
.....
//need to define this to stop the warning messages
#define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA
I'm almost certain that I had to do something else to get rid of a "SDK doesn't support DCOM" or something like that, but I can't remember.
I'm using a private class member to hold the pointer to the xml doc.
CComPtr<MSXML::IXMLDOMDocument2> pDocument;
I use the following to initialize com and create the instance.
- Code:
//Project::Open()
hResult = ::CoInitializeEx(NULL, NULL);
CoCreateInstance(MSXML::CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, MSXML::IID_IXMLDOMDocument2, (void**)&project->pDocument);
...
I have a two step process where I will open a project (above), and then (in a later thread) initialize it (below).
- Code:
//Project::Init()
this->pDocument->selectNodes(BSTR(_T("//object")), &resultList);
...
The init code above is the first interaction with the document in this new thread. At this point the program hangs and after a couple seconds crashes. My feeling is that the COM context is getting messed up between threads because if I call Both "OPen" and "Init" in the same thread the code (seemingly) works.
I'm an experienced programmer but quite novice in c++ so any information is helpful and appreciated.
Thanks.