While using Language Integrated Query with XML we first create an XML file or have data into database in XML form
This is our XML file
Ex: Himanshu Joshi 04/06/2010 Mayank Aggrawal 12/12/1997
To read these details we will write code for it
//Load the file to transform.
XPathDocument doc = new XPathDocument(filename);
//Create an XmlTextWriter which outputs to the console.
XmlTextWriter writer = new XmlTextWriter(Console.Out);
//Transform the file and send the output to the console.
xslt.Transform(doc, null, writer, null);
writer.Close();
The XPathDocument is used to load the XML file which contains the details of the employees.
After that we have used the XMLTextWriter class that is used to output the data form the file.
The XSLT transform is the class that is mainly used to deal with the design and CSS part of the XML file.
Here we are first loading the document into it and after that printing the output into the console.
0 Comment(s)