Aparna

Aparna

  • NA
  • 1
  • 0

Updating XML file

Jul 17 2008 12:23 AM

I have an xml file say Example.xml which is like...

<?xml version="1.0"?>
<TableProperties Name="ScoreTable">
  <Table ID="Table0" DisplayName="Tb0">
    <Database>indiansections</Database>
    <Country>India</Country>
    <Material>Steel</Material>
    <Category>RolledSteel</Category>
  </Table>
  <Table ID="Table1" DisplayName="Tb1">
    <Database>indiansections</Database>
    <Country>India</Country>
    <Material>Steel</Material>
    <Category>RolledSteel</Category>
  </Table>
  <Table ID="Table2" DisplayName="Tb2">
    <Database>indiansections</Database>
    <Country>India</Country>
    <Material>Steel</Material>
    <Category>RolledSteel</Category>
  </Table>
  <Table ID="Table3" DisplayName="Tb3">
    <Database>indiansections</Database>
    <Country>India</Country>
    <Material>Steel</Material>
    <Category>RolledSteel</Category>
  </Table>
  <Table ID="Table4" DisplayName="Tb4">
    <Database>indiansections</Database>
    <Country>India</Country>
    <Material>Steel</Material>
    <Category>RolledSteel</Category>
  </Table>
  <Table ID="Table5" DisplayName="Tb5">
    <Database>indiansections</Database>
    <Country>India</Country>
    <Material>Steel</Material>
    <Category>RolledSteel</Category>
  </Table>
  <Table ID="Table6" DisplayName="Tb6">
    <Database>indiansections</Database>
    <Country>India</Country>
    <Material>Steel</Material>
    <Category>RolledSteel</Category>
  </Table>
</TableProperties>

I have created the xml using XmlTextWriter in a button click event. Now what i want to do is add a complete block to this xml like

<Table ID="Table7" DisplayName="Tb7">
    <Database>americansections</Database>
    <Country>America</Country>
    <Material>Steel</Material>
    <Category>ColdFormedSteel</Category>
  </Table>

before the end tag of </TableProperties>

Being new to c# i am a bit confused of how to do this. Any sort of help will be much appreciated...

Thanks in advance.

 


Answers (1)