Questions tagged [linq-to-xml]

LINQ-to-XML provides a SQL-like query experience for navigating, parsing, and aggregating data stored in XML documents.

LINQ-to-XML provides a SQL-like query experience for navigating, parsing, and aggregating data stored in XML documents.

Related Links

5019 questions
1
vote
2 answers

Parsing policy through LINQ to XML

Abhi
  • 5,501
  • 17
  • 78
  • 133
1
vote
1 answer

internal server error while trying to load content into xdocument

XDocument xDoc = new XDocument(); HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri); req.Timeout = 1000 * 60 * 5; WebResponse res = req.GetResponse(); Stream responseStream = res.GetResponseStream(); xDoc =…
Navyseal
  • 891
  • 1
  • 13
  • 36
1
vote
2 answers

Getting content of a tag in LINQ to XML with namespaces

I need to get the content of the POIssuedDate tag of the below XML using LINQ. Below is the code I wrote that I think should work. EDIT : Just tried with XNamespace bat = @"x-commerceone:document:btsox:Batch.sox$1.0"; and XNamespace bat =…
Tom Squires
  • 8,848
  • 12
  • 46
  • 72
1
vote
2 answers

Using var anonymous object getting InvalidCastException for LINQ

I am getting error while trying to loop through query object using var variable in foreach construct. I am loading xml in to dataset and performing Dataset to Linq for explicit reasons. Please correct my mistake. This is my…
user1061293
  • 167
  • 1
  • 4
  • 14
1
vote
3 answers

Query an xml file using linq to xml?

I have the following xml file:
Macnique
  • 1,028
  • 2
  • 19
  • 44
1
vote
3 answers

Descendants within descendants in LINQ to XML

I'm struggling to navigate to my 'user' element in my XML; I want a set of users so I can then extract username details. My LINQ query is as follows and always returns 0 for the count (though is not null) var xApprovers = from d in…
Ian
  • 879
  • 8
  • 21
1
vote
2 answers

Does Linq-to-Xml queries support intellisence in C#?

In my project I am using an XML-file for datastorage. I am accessing that file with linq-to-xml queries. Actually I have created that XML-file from my SQL-server database but as that tables in SQL contained more that 50 columns, the resulting…
1
vote
2 answers

parsing XML using linq to xml

I want to parse some large XML file using linq to XML but I don't know how exactly can I do this. I want to read all tag that come after tag. I must mentioned I have many tag in XMl file I just want to read that one come after…
Am1rr3zA
  • 7,115
  • 18
  • 83
  • 125
1
vote
2 answers

Read xml Element value WITHOUT cdata?

I have this simple xml : Beatles 1 2 Doors
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
1
vote
1 answer

using linq2Xml to edit element but with Xpath?

Im loading an xml from stream XDocument xmlFile = XDocument.Load(stream); var query = from c in xmlFile.Elements("//Band") //error here select c; modify query.... Is it possible to find elements which are in…
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
1
vote
2 answers

Get reader from Xnode doesn't work

I tried to get the attributes from XNode I use the following code XDocument document = XDocument.Load(FilePath); var Elements = from p in document.Descendants(modality) select p.Elements("Key_Part"); //var Attriputess =…
AMH
  • 6,363
  • 27
  • 84
  • 135
1
vote
4 answers

XDocument saves & instead of just &

I am using XDocument to switch a value in an xml document. In the new value I need to use the character '&' (ampersand) but after XDocument.save() the xml has & instead! I tried using encoding and stuff… nothing worked
Ron Gross
  • 1,474
  • 5
  • 19
  • 34
1
vote
3 answers

How to load an XML file from a file in the solution, build with Embedded Resource?

Here's an outline of my solution: I've set the build to Embedded Resource and when I generate the application the XML file doesn't appear in the /Release folder. This is correct, I want this behavior. Now I'm trying to load that file into an…
Only Bolivian Here
  • 35,719
  • 63
  • 161
  • 257
1
vote
1 answer

How to generate xml file with specific structure from datatables?

Q : According to some choices of the user, i will get set of Datatables from the database. i have three datatabels:Teachers,Subjects,ClassRooms and I want an xml file with the following structure:
Anyname Donotcare
  • 11,113
  • 66
  • 219
  • 392
1
vote
1 answer

Loading resources from another project?

I'm trying to load an XML file from a separate project; One of these projects is a game engine, which calls the XML document reader and takes in a path specifying the relative directory to the file. From Engine XDocument doc; try …
zeboidlund
  • 9,731
  • 31
  • 118
  • 180