Código:
#include <msxml.h>
//...
void __fastcall TForm1::Button1Click(TObject *Sender)
{
CoInitialize(NULL);
IXMLDOMDocument* xml;
CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER, __uuidof(IXMLDOMDocument), (void**)&xml);
short isSuccessful;
VARIANT xmlSource = {VT_BSTR};
xmlSource.bstrVal = SysAllocString(L"STFW.xml");
xml->load(xmlSource, &isSuccessful);
if (isSuccessful)
{
IXMLDOMElement* root;
xml->get_documentElement(&root);
IXMLDOMNodeList* nodes;
root->get_childNodes(&nodes);
IXMLDOMNode* child;
BSTR text = new wchar_t(666);
BSTR nodeName = new wchar_t(666);
while (!nodes->nextNode(&child))
{
child->get_text(&text);
child->get_nodeName(&nodeName);
MessageBoxW(Handle, text, nodeName, 0);
child->Release();
}
nodes->Release();
root->Release();
}
SysFreeString(xmlSource.bstrVal);
xml->Release();
CoUninitialize();
}
Nota; aunque opino igual que coso, creo que el anterior code no se ha visto con anterioridad.
PD; el título del hilo esta mal!
Saludos