Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

How can i assign multiple classes to xmldocument object?

$
0
0

I am creating a one service for Inserting(POST) data,

using this service client enter the data after that call service method to store that data in file (XML or JSON) in system

public void Add(Employee newEmployee)
        {
            XDocument doc = XDocument.Load(HttpContext.Current.Server.MapPath("StudentDB.xml"));
doc.Element("Employees").Add(
Department de=new Department();
            doc.Element("Employees").Add(
                new XElement("Employee",
                    new XElement("EmpId",newEmployee.EmpNo),
                    new XElement("EmpName",newEmployee.EmpName),
                    new XElement("DeptName",newEmployee.DeptName),
                new XElement("Department",
                    new XElement("DeptNo", de.DeptNo),
                    new XElement("Dname", de.Dname),
                    new XElement("Location", de.Location)
                )));

 doc.Save(HttpContext.Current.Server.MapPath("StudentDB.xml"));
        }
that web service post method
i am making client to call insert
when i call it, can you take that data and write to a file and save in to file folder any where in system

How can i do this?

The above code is correct ?

I want output like this



anilbabu


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>