Hello,
I have a problem in using transformNodeToObject using MSXML4.0.
I have a VC++ MFC application in which msxml4.dll has been included using
OLE Automation (as a type library).
This creates the wrapper files msxml4.h and .cpp files.
Here, I have a sample.xml file and a corresponding sample.xsl file. I want
to create a new DOM Document using the above API by performing
transformNodeToObject. Here the code goes:
// Load the source XML Doc
IXMLDOMDocument aXMLDoc;
aXMLDoc.CreateDispatch("Msxml2.DOMDocument.4.0");
aXMLDoc.load(COleVariant("c:\\sample.xml"));
// Load the XSL Document
IXMLDOMDocument aXSLDoc;
aXSLDoc.CreateDispatch("Msxml2.DOMDocument.4.0");
aXSLDoc.load(COleVariant("c:\\sortsample.xsl"));
// Create an empty Result DOM Document
IXMLDOMDocument aXMLResDoc;
aXMLResDoc.CreateDispatch("Msxml2.DOMDocument.4.0");
VARIANT aVar;
memset(&aVar, 0, sizeof(aVar));
aVar.vt = VT_DISPATCH;
aVar.pdispVal = aXMLResDoc.m_lpDispatch;
aXMLDoc.transformNodeToObject(aXSLDoc.m_lpDispatch,
aVar);
COleVariant aDest("c:\\out.xml");
aXMLResDoc.save(aDest);
aXMLResDoc.DetachDispatch();
aXSLDoc.DetachDispatch();
aXMLDoc.DetachDispatch();
Here, looks like the way I am passing the output VARIANT DOMDocument object
is not proper. I am getting an exception in transformNodeToObject. The API
wrapper created using the above automation for transformNodeToObject is
IXMLDOMDoucment::transformNodeToObject(LPDISPATCH stylesheet,
const VARIANT &outputobject);
Can you please tell me how should i pass the resultant DOMDocument object as
a VARIANT for this function?
I am stuckup with this problem and not able to proceed further.
Thanks in advance,
Nirmala
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list