How to add parent node to existing xml file using c#?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Krithiha
    New Member
    • Jul 2008
    • 1

    How to add parent node to existing xml file using c#?

    I have a XML document having Student data, such as name, contact and program enrolled.
    ex:
    <Student>
    <FirstName>Clai re</FirstName>
    <LastName>Damen </LastName>
    <AddressLine>4A , Lane7</AddressLine>
    <City>NH</City>
    <State>Alaska </State>
    <ProgramEnrolle d>New Program</ProgramEnrolled >
    <EnrollmentDate >2007-09-05</EnrollmentDate>
    </Student>
    I need to add parent nodes around the existing data, something like below.
    <Student>
    <Name>
    <FirstName>Clai re</FirstName>
    <LastName>Damen </LastName>
    </Name>
    <Contact>
    <AddressLine>4A , Lane7</AddressLine>
    <City>NH</City>
    <State>Alaska </State>
    </Contact>
    <Program>
    <ProgramEnrolle d>New Program</ProgramEnrolled >
    <EnrollmentDate >2007-09-05</EnrollmentDate>
    </Program>
    </Student>

    I have many sets of student data like this in the XML.
    Thanks in advance.
Working...