Part 1 LINQ to XML

If you are a foodie like me, I am sure you will enjoy the recipes on my friend’s YouTube channel. If you find them useful, please subscribe and share to support her. She’s really good at what she does.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA

Creating an XML document using LINQ to XML.

Text version of the video
http://csharp-video-tutorials.blogspot.com/2014/08/part-1-linq-to-xml.html

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
https://www.youtube.com/channel/UC7sEwIXM_YfAMyonQCrGfWA/?sub_confirmation=1

Slides
http://csharp-video-tutorials.blogspot.com/2014/08/part-1-linq-to-xml_18.html

LINQ to SQL Tutorial – All Text Articles & Slides
http://csharp-video-tutorials.blogspot.com/2014/08/linq-to-xml-tutorial.html

LINQ to XML Tutorial Playlist

Dot Net, SQL, Angular, JavaScript, jQuery and Bootstrap complete courses
https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd

What is Functional Construction?
As far as LINQ to XML is concerned there is a technical term called Functional Construction. First let us understand what this term means with an example. Functional construction is the ability to create an XML tree in a single statement.

Let us now discuss, creating an an XML tree in a single statement.

All the classes to create an XML document are present in System.Xml.Linq namespace. To create
XML Document use XDocument class
XML Declaration use XDeclaration class
XML Comment use XComment class
XML Element use XElement class
XML Attribute use XAttribute class
Code to create the XML Document
using System.Xml.Linq;

namespace Demo
{
class Program
{
public static void Main()
{
XDocument xmlDocument = new XDocument(
new XDeclaration(“1.0”, “utf-8”, “yes”),

new XComment(“Creating an XML Tree using LINQ to XML”),

new XElement(“Students”,

new XElement(“Student”, new XAttribute(“Id”, 101),
new XElement(“Name”, “Mark”),
new XElement(“Gender”, “Male”),
new XElement(“TotalMarks”, 800)),

new XElement(“Student”, new XAttribute(“Id”, 102),
new XElement(“Name”, “Rosy”),
new XElement(“Gender”, “Female”),
new XElement(“TotalMarks”, 900)),

new XElement(“Student”, new XAttribute(“Id”, 103),
new XElement(“Name”, “Pam”),
new XElement(“Gender”, “Female”),
new XElement(“TotalMarks”, 850)),

new XElement(“Student”, new XAttribute(“Id”, 104),
new XElement(“Name”, “John”),
new XElement(“Gender”, “Male”),
new XElement(“TotalMarks”, 950))));

xmlDocument.Save(@”C:DemoDemoData.xml”);
}
}
}

Upon running the console application, an XML file with name Data.xml should be created in the respective project folder. To see the xml file, click on “Show All Files” icon in the solution explorer. Double click on the xml file to open it in visual studio.

source by kudvenkat

xml programming

Mourad ELGORMA

Fondateur de summarynetworks, passionné des nouvelles technologies et des métiers de Réseautique , Master en réseaux et système de télécommunications. ,j’ai affaire à Pascal, Delphi, Java, MATLAB, php …Connaissance du protocole TCP / IP, des applications Ethernet, des WLAN …Planification, installation et dépannage de problèmes de réseau informatique……Installez, configurez et dépannez les périphériques Cisco IOS. Surveillez les performances du réseau et isolez les défaillances du réseau. VLANs, protocoles de routage (RIPv2, EIGRP, OSPF.)…..Manipuler des systèmes embarqués (matériel et logiciel ex: Beaglebone Black)…Linux (Ubuntu, kali, serveur Mandriva Fedora, …). Microsoft (Windows, Windows Server 2003). ……Paquet tracer, GNS3, VMware Workstation, Virtual Box, Filezilla (client / serveur), EasyPhp, serveur Wamp,Le système de gestion WORDPRESS………Installation des caméras de surveillance ( technologie hikvision DVR………..). ,

17 réflexions sur “Part 1 LINQ to XML

Laisser un commentaire