I like LINQ to XML a lot. I still ahve the heart of a purist when it comes to the DB access, but I think that giving XML developers better tools is nothing but good, especially when it shares a common syntax with other query methods, as LINQ does.
J.Ja
Discussion on:
View:
Show:
Not being mad keen on datasets, I've been looking at wholly service oriented architectures, where database content is exposed as xml documents through a webservice model. That's nice until you want to composite on an adhoc(ish) basis. Linq gives you this facility in a very natural and extensible way.
Cleverer than a tin of brains.
Using it intead of SQl on the database, I can't see a lot of use for, and I'm not sanguine about how efficient the autogenerated SQL would be, especially if the DBMS wasn't SQL Server.
Cleverer than a tin of brains.
Using it intead of SQl on the database, I can't see a lot of use for, and I'm not sanguine about how efficient the autogenerated SQL would be, especially if the DBMS wasn't SQL Server.
When I try to print this article, nothing happens. Other articles print OK.
I have two xmls which are to be accessed using single Linq query.
(XML1)
emp1
empname
(XML2)
emp2
empname
Now in two xmls i want to insert info in products,customers,quality,personnel tags in xml1 and in products,customers in xml2 using general linq query.
can u throw some light on this using c# code
Thanks
Manas
(XML1)
emp1
empname
(XML2)
emp2
empname
Now in two xmls i want to insert info in products,customers,quality,personnel tags in xml1 and in products,customers in xml2 using general linq query.
can u throw some light on this using c# code
Thanks
Manas
I use LINQ a lot with my xml, today i came across an unusual situation which has had me scratching my head. How do you handle xml when the nodes do not contain the same fields. say i had an xml file of various objects where each object had different number of properties
Had a lot of trouble completing my assignment. Linq-to-XML makes it all seem pretty easy.
I appreciate your sharing your knowledge. Made me say "what a wonderful world" again..
I appreciate your sharing your knowledge. Made me say "what a wonderful world" again..
Thank you for excellent examples! With using System.Linq in addition to already specified namespace at the top of the article it all works perfectly.
I believe that your explanation and code are somewhat incorrect.
In describing the makeup of the XML document you state the following:
In fact, the root node is actually called sites and contains one or more nodes called site.
Not being nit-picky but it makes a huge difference because then the LINQ query and just about anything else you attempt will fail.
In describing the makeup of the XML document you state the following:
The XML in the following example defines an XML document with a root node called site. This root node contains one or more nodes called sites that include elements called name and url. The site element includes an attribute called technical.
In fact, the root node is actually called sites and contains one or more nodes called site.
Not being nit-picky but it makes a huge difference because then the LINQ query and just about anything else you attempt will fail.
This is very easy and useful example. I used to similar thing in different way, after reading this article I realised how easily could be done.
- Keyboard Shortcuts:
- Prev
- Next
- Toggle

































