Setting text for IXMDOMNodePtr

143 views Asked by At

I have a MFC application for which Character set is "Not set".

I am using MSXML to create a XML.

When I try the following, the code crashes -

std::string lText ("abc");
MSXML2::IXMLDOMNodePtr pAttr = GetAttr(); //pNode is initialized fine
pNode->text = (_bstr_t)lText.c_string();

Surprisingly, this code was working fine till Visual studio 2008. Now I am using Visual studio 2013, and it crashes.

I am using the following way to make my code work.

    variant.vt = VT_BSTR;
    variant.bstrVal = bValue;
    pAttr->put_nodeValue(variant);

This works but I do not know what really went wrong. Please help??

0

There are 0 answers