Welcome to MSDN Blogs Sign in | Join | Help

Wriju's BLOG

.NET and everything

Browse by Tags

All Tags » LINQ to XML   (RSS)
LINQ to XML : Understanding Annotations
Annotations are used for private use. It does not directly associated and known as Black Box in XML world. This can also be considered as meta tag. Below is an example on how it can be handled. I have created a sample Windows Applications and will try Read More...
LINQ – Uniformity All Over
I have spent a while with LINQ and still feel very new whenever I explore some new power. Here I am going to describe you how LINQ uniformly allows you write for the various types of data. In-memory data source ++++++++++++++++ List < int > arrInt Read More...
LINQ to XML : Querying XML with Namespaces
This question arises in one of discussions. If you have a XML document with “xmlns” then LINQ to XML does not return any IEnumerable<T> J . This is strange but true for XPath and XQuery. There is a trick to get it done, Let us assume that you have Read More...
LINQ : IEnumerable<T> and IQueryable<T>
IEnumerable<T> and IQueryable<T> are the two most used terms of any LINQ discussion. What I am trying to here is that I am trying to simplify the two interfaces depending on their behavior. In LINQ world we generally have few providers available Read More...
LINQ to XML : Modifying XML document
You have XML document now you want to modify that XML file using LINQ to XML. It is as easy as you generally modify any database column value. Let us create a dummy XML stream, //Create dummy XML to work var root = new XElement ( "parent" , from i in Read More...
LINQ to XML : Changing connectionString in app.config
When you create data bind application using wizard in Windows Forms application and connection string gets added to you settings file. Now you may be interested in changing that connection string but problems, 1) The connection string in settings has Read More...
LINQ to XML : Adding Namespace quickly
I have written a post earlier on how to attach Namespaces . After reading my article someone complained about the redundancy of the code. I also realized the pain. I was reading the book C# 3.0 In a Nutshell. There I got a very elegant solution. Let me Read More...
LINQ to XML : Join Xml Data
Let’s say I have created two Xml files using LINQ to XML from Northwind database. I have taken two tables Category and Products and tried to join between two different files. Category XML <? xml version = " 1.0 " encoding = " utf-8 " ?> < categories Read More...
LINQ to XML : Working with Prefixes
Based on my previous post on LINQ to XML : Working with Namespaces , if you want to add prefixes to your Xml things becomes little crazy. The trick is that you have to use XAttribute() to attach prefixes. So the Xml as below need the following code, < Read More...
LINQ to XML : Working with Namespaces
If you are working with complex real world XML then you have to deal with namespaces to disambiguate. There are several ways to implement namespaces in LINQ to XML. One is you can use pure string to add your namespace with each element declaration, like Read More...
LINQ to XML : Creating complete XML document
LINQ to XML API allows us to create complete XML document as expected with all the elements. So this X-DOM has everything as you expect. Simple sample looks like, XDocument doc = new XDocument ( new XDeclaration ( "1.0" , "utf-16" , "true" ), new XProcessingInstruction Read More...
LINQ to XML : Creating XML from another XML
Based on my previous post if I have to filter the list of customers only in the country “US” and create another XML which may look like, <? xml version = " 1.0 " encoding = " utf-8 " ?> < usaCustomers > < usaCustomer > < title > Read More...
LINQ to XML : Creating complex XML through LINQ
We can generate hierarchical object graph in our memory though LINQ. To be more realistic we can bring data from relational database. So if we consider Northwind database and use LINQ to SQL to bring all the Customers and their Orders and Order Details Read More...
LINQ to XML : Two important classes XElement and XAttribute
XElement and XAttribute are the two very important classes available in System.Xml.Linq.dll assembly. Using these two classes you can do lot of things in the LINQ to XML world. I will show you step by step how, For just an element XElement _root = new Read More...
Page view tracker