XMlSerialization - Append to existing object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RJN

    #1

    XMlSerialization - Append to existing object

    Hi

    I'm using XMlSerailizer to write certain content to file. If the file
    exists, I'm supposed to append the xml to the file.

    eg.,

    <EmployeeList >
    <Employee></Employee>
    </EmployeeList>

    Assume when serializing for the first time, I get an xml like the above.
    When I further serialize employee records when the application is run
    next time, I'm supposed to append it to the list of employees that
    already exist. If I use streamwriter to append the file, it writes after
    the closing tag of EmployeeList. One way is to deserialize the existing
    xml, then add the new employees into this object and then again
    serialize. But this will be a huge overhead. Is there better way of
    doing this?

    Regards

    rjn

    *** Sent via Developersdex http://www.developersdex.com ***
Working...