all groups > dotnet xml > january 2008 >
You're in the

dotnet xml

group:

Converting MSXML2 to System.Xml: transformNodeToObject functionality?


Converting MSXML2 to System.Xml: transformNodeToObject functionality? Ed Bates
1/16/2008 12:53:40 PM
dotnet xml:
Hello.

I'm attempting to convert an XML wrapper class from VB6 (using MSXML2) to .NET (using System.Xml). For my TransformDocument method, the MSXML2 code uses the transformNodeToObject method for XSL transformation, using DOMDocument30 objects for the target and both parameters. In System.Xml, it appears that I must use the Xsl.XslCompiledTransform.Transform method. This is much more complex for internal object references, and it appears that in using the new method to get back an XmlDocument object, I must through an intermediate text file or stream, which seems quite inefficient to me.

The old way of applying a transformation was:

Call mobReturnDoc.DocumentElement.transformNodeToObject(mobTemplateDoc, mobReturnDoc)

...but the new and improved way appears to be:

Dim lobTransform As Xsl.XslCompiledTransform = New Xsl.XslCompiledTransform()
Dim lobXfmdDoc As System.IO.Stream
Call lobTransform.Load(mobTemplateDoc)
Call lobTransform.Transform(mobReturnDoc.DocumentElement, Nothing, lobXfmdDoc)
Call mobReturnDoc.Load(lobXfmdDoc)

Anyone go through this already and have suggestions, or is this the best way to do it?

Thanks,
-- Ed

From http://www.developmentnow.com/g/49_0_0_0_0_0/dotnet-xml.htm

Posted via DevelopmentNow.com Groups
AddThis Social Bookmark Button