Register  Login       Search  
Forum  
 
  
 
Forum  Forum     
 
SearchForum Home
  XML Lab Products  nxslt  MSBuild Task Er...
 MSBuild Task Error, Not closing input file
 
JulianS
1 posts
Joined
10/26/2007

MSBuild Task Error, Not closing input file
Posted: 26 Oct 07 6:18 AM (South Africa)

Hi,

It appears that after the input file is transformed the srcReader is not closed, this doesn't affect the command line app. But when using the msbuild task this prevents you from modifying the original file until the msbuild project is completed.

I just added a call to the close method of the reader and all seems to be fixed!

NxsltMain.cs:131-147

if (options.GetStylesheetFromPI)
{
//To get stylesheet from the PI we load source XML into
//XPathDocument (consider embedded stylesheet)
XPathDocument srcDoc = new XPathDocument(srcReader, XmlSpace.Preserve);
XPathNavigator srcNav = srcDoc.CreateNavigator();
//Now srcReader reads in-memory cache instead
srcReader = srcNav.ReadSubtree();
MvpXslTransform xslt = PrepareStylesheetFromPI(srcNav, stylesheetResolver);
Transform(srcReader, xslt, srcResolver);
}
else
{
MvpXslTransform xslt = PrepareStylesheet(stylesheetResolver);
Transform(srcReader, xslt, srcResolver);
}
srcReader.Close();

 

 

Thanks
Julian

  XML Lab Products  nxslt  MSBuild Task Er...
Forum Home  Search