Vipul Kelkar

Vipul Kelkar

  • NA
  • 1.9k
  • 569k

Write XML nodes to file

Aug 29 2011 8:45 AM
Hi,

Has anyone come acroos this scenario
I have a XML file of the following structure        

<Customers>
        <Customer>
                <FirstName></FirstName>
                <LastName></LastName>
        </Customer>
        <Customer>
                <FirstName></FirstName>
                <LastName></LastName>
        </Customer>
</Customers>

Now i need to append a  "Customer" tag programatically to the XML file. I was able to add <Customer></Customer> using appendchild() to the root tag. But it did not write the children "firstname" and "lastname".What is a better way that will add the entire Customers tag block including firstname and lastname

Answers (5)