xsl-list
[Top] [All Lists]

RE: Usage of transformNodeToObject using MSXML4.0, VC++, MFC (Automation)

2002-10-17 21:49:52
Hello,

I could solve the problem.
It was because the out xml created after applying the xsl for the input xml
was not a well-formed xml document. (There was no root element). Since
for transformNodeToObject, am giving a DOMDoucment object pointer as the
resultant output, the transformed result could not make a proper resultant
DOMDocument and an exception was thrown.

Thanks & Regards,
Nirmala


-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of 
Nirmala R
Sent: Thursday, October 17, 2002 9:00 AM
To: Xsl-List
Subject: [xsl] Usage of transformNodeToObject using MSXML4.0, VC++, MFC
(Automation)


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

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>