如何将一个字符串写入xml文件中
例如下面的一个字符串,想把他写入xml文件中
CComBSTR comBstr = OLESTR(<?xml version=\"1.0\" encoding=\"gb2312\"?><?xml-stylesheet href=www.abc.com type=\"text/xsl\"?><channel></channel>")
我这样调用
HRESULT hr = pIDoc.CoCreateInstance( CLSID_DOMDocument );
if(SUCCEEDED(hr) && pIDoc)
{
BSTR bstr = CComBSTR(pXMLInfo);
hr = pIDoc->loadXML(CComBSTR(comBstr), &varB);
pIDoc->put_text(bstr);
CComVariant localfile = "C:\\abc.xml";
pIDoc->save(localfile);
pIDoc.Release();
}
发现不行
求助