XmlTextWriter and XmlTextReader causes me an error

Discussion in 'C#' started by KFO, Jun 5, 2007.

  1. KFO

    KFO New Member

    Joined:
    Jun 5, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,335
    Likes Received:
    377
    Trophy Points:
    83
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice