0

I have an XML like this;

<?xml version="1.0" standalone="yes"?>
<Claim.Submission>
  <Header>
    <SenderID>DHA123</SenderID>
    <ReceiverID>A002</ReceiverID>
    <TransactionDate>2012-07-05T15:00:00+05:30</TransactionDate>
    <RecordCount>3</RecordCount>
    <DispositionFlag>PRODUCTION</DispositionFlag>
  </Header>
  <Claim>
    <ID>123</ID>
    <MemberID>m01254</MemberID>
    <PayerID>A002</PayerID>
    <ProviderID>DHA123</ProviderID>
    <EmiratesIDNumber>111-1111-1111111-1</EmiratesIDNumber>
    <Gross>100</Gross>
    <PatientShare>0</PatientShare>
    <Net>100</Net>
  </Claim>
 </Claim.Submission>

but I want to add a datatable in the <Claim> node dynamically. ie; I want the XML as

<?xml version="1.0" standalone="yes"?>
<Claim.Submission>
  <Header>
    <SenderID>DHA123</SenderID>
    <ReceiverID>A002</ReceiverID>
    <TransactionDate>2012-07-05T15:00:00+05:30</TransactionDate>
    <RecordCount>3</RecordCount>
    <DispositionFlag>PRODUCTION</DispositionFlag>
  </Header>
  <Claim>
    <ID>123</ID>
    <MemberID>m01254</MemberID>
    <PayerID>A002</PayerID>
    <ProviderID>DHA123</ProviderID>
    <EmiratesIDNumber>111-1111-1111111-1</EmiratesIDNumber>
    <Gross>100</Gross>
    <PatientShare>0</PatientShare>
    <Net>100</Net>
  <Encounter>
    <FacilityID>DHA123</FacilityID>
    <Type>3</Type>
    <PatientID>1245</PatientID>
    <Start>2012-01-01T12:00:00+05:30</Start>
    <End>2012-01-05T15:00:00+05:30</End>
    <StartType>1</StartType>
    <EndType>1</EndType>
  </Encounter>
 </Claim>
</Claim.Submission>
wcraft
  • 473
  • 6
  • 10

1 Answers1

0

You can try using the XmlTextWriter class to write to an XML file:

http://msdn.microsoft.com/en-us/library/system.xml.xmltextwriter.aspx

If you will write to an existing file, it will replace the file contents with the contents you specified, so make sure you update the records properly or you may lose the stored information.

wcraft
  • 473
  • 6
  • 10
  • I am new to this.So please attach a sample. I have many datatables to be added to different nodes, so i want to select specified nodes. – Remya Viswan Jan 29 '13 at 10:24