XmlTextWriter and XmlTextReader causes me an error

KFO
Newbie Member
5Jun2007,11:25   #1
KFO's Avatar
The process cannot access the file 'D:\file.xml' because it is being used by another process.

This is the error i get because i started with Reading the file.xml and then i write it again in the same class using XmlTextWriter and XmlTextReader.
my objective here is to read xml file to process it and provide the user a flexability to edit this xml file and then i rewrite it. However this error is keep coming up to me. I am writing a console and a windows application
any advice?
Thanks
Go4Expert Founder
5Jun2007,12:26   #2
shabbir's Avatar
2 things

XmlTextWriter and XmlTextReader helps in appending and not editing for that you need to use XMLDocument.

Also regarding the error it looks you are not closing the XML file after reading.