我的例子
_bstr_t Temp;
IXMLDOMDocumentPtr pXMLDoc;
IXMLDOMElementPtr pElement, pElementSub;
HRESULT hr =pXMLDoc.CreateInstance(__uuidof(DOMDocument));
if(!SUCCEEDED(hr))
{
AfxMessageBox("Cannot create the DOMDocument object,Please check MS XML Parser run library!");
return "";
}
try
{
pXMLDoc->loadXML((_bstr_t)OrgStr); pElement = pXMLDoc->selectSingleNode("xml"); pElement->removeAttribute("xmlns:s");
pElement->removeAttribute("xmlns:dt"); pElementSub = pElement->selectSingleNode("s:Schema"); pElement->removeChild(pElementSub);
Temp = pElement->Getxml();
}
catch (_com_error& comerr)
{
IErrorInfo* pErrorInfo = comerr.ErrorInfo();
HRESULT hr = comerr.Error();
if (pErrorInfo)
{
BSTR bsDesc = NULL;
pErrorInfo->GetDescription( &bsDesc );
_bstr_t sDesc( bsDesc, false );
AfxMessageBox(sDesc.operator LPCTSTR());
pErrorInfo->Release();
}
return "ERROR";
} CString DesStr((LPCSTR)Temp);
return DesStr;
_bstr_t Temp;
IXMLDOMDocumentPtr pXMLDoc;
IXMLDOMElementPtr pElement, pElementSub;
HRESULT hr =pXMLDoc.CreateInstance(__uuidof(DOMDocument));
if(!SUCCEEDED(hr))
{
AfxMessageBox("Cannot create the DOMDocument object,Please check MS XML Parser run library!");
return "";
}
try
{
pXMLDoc->loadXML((_bstr_t)OrgStr); pElement = pXMLDoc->selectSingleNode("xml"); pElement->removeAttribute("xmlns:s");
pElement->removeAttribute("xmlns:dt"); pElementSub = pElement->selectSingleNode("s:Schema"); pElement->removeChild(pElementSub);
Temp = pElement->Getxml();
}
catch (_com_error& comerr)
{
IErrorInfo* pErrorInfo = comerr.ErrorInfo();
HRESULT hr = comerr.Error();
if (pErrorInfo)
{
BSTR bsDesc = NULL;
pErrorInfo->GetDescription( &bsDesc );
_bstr_t sDesc( bsDesc, false );
AfxMessageBox(sDesc.operator LPCTSTR());
pErrorInfo->Release();
}
return "ERROR";
} CString DesStr((LPCSTR)Temp);
return DesStr;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货