XslCompiledTransform error

V

Vinod

Hi,

I am having a problem doing the transform.
Actually i am migrating the code from XslTranform class into
XslCompiledTransform class.

Here is the code that i am using in .net 1.1

private void DoTransform(ref XslTransform[] arrTransformations,
ref XmlDocument objSource,
ref XmlDocument objTarget,
XsltArgumentList xsltArgs,
XmlResolver xmlResolver)
{
try
{
msXML = new MemoryStream();
objSource.Save(msXML);

msXML.Seek(0,SeekOrigin.Begin);
objTarget = new XmlDocument();
objTarget.Load(msXML);

for(intCount = 0;intCount < arrTransformations.Length;intCount++)
{
msXML = new MemoryStream();
arrTransformations[intCount].Transform(objTarget,xsltArgs,msXML,xmlResolver);

msXML.Seek(0,SeekOrigin.Begin);
objTarget = new XmlDocument();
objTarget.Load(msXML);
}
}
catch
{
throw;
}
finally
{
msXML = null;
}
}

Migrated the above code into .net 2.0:


private void DoTransform(ref XslCompiledTransform[] arrTransformations,
ref XmlDocument objSource,
ref XmlDocument objTarget,
XsltArgumentList xsltArgs,
XmlResolver xmlResolver)
{
try
{
msXML = new MemoryStream();
objSource.Save(msXML);

msXML.Seek(0, SeekOrigin.Begin);
objTarget = new XmlDocument();
objTarget.Load(msXML);

for (intCount = 0; intCount < arrTransformations.Length;
intCount++)
{
msXML = new MemoryStream();
XmlReaderSettings settings = new XmlReaderSettings();
settings.ProhibitDtd = false;
XmlReader reader = XmlReader.Create(new
StringReader(objSource.InnerXml), settings);
arrTransform[intCount].Transform(reader, xsltArgs,
msXML);/// got error here

msXML.Seek(0, SeekOrigin.Begin);
objTarget = new XmlDocument();
objTarget.Load(msXML);
}
}
catch
{
throw;
}
finally
{
msXML = null;
}
}

Error :An error occurred while loading document 'C:\test.xml'. See
InnerException for a complete description of the error.

i get the same error even when i tried this
arrTransform[intCount].Transform(new XmlNodeReader ( xmlDoc), xsltArgs,
msXML );

please help me out on this.

Regards,
Vinod
 
J

Jeroen Mostert

Vinod said:
Error :An error occurred while loading document 'C:\test.xml'. See
InnerException for a complete description of the error.
It says to check the InnerException. Have you checked the InnerException?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top