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
0 answers

Converting XmlElement To XElement and vice-versa in C#

Possible Duplicate: Converting XDocument to XmlDocument and vice versa Is there a simple way to convert XmlElement To XElement?
frankyt79
  • 251
  • 4
  • 9
1
vote
1 answer

How to get XML inner element and update it using Xpath or LINQ to XML

I have XML like 1000 3 I want to search for either Nurse or Dr, and update certain inner element's…
AMH
  • 6,363
  • 27
  • 84
  • 135
1
vote
2 answers

Parsing XDocument using UTF-8 format and saving to MySQL as UTF-8 error

I am parsing an XML document that is in UTF-8 format as follows: XDocument doc = GetXmlFeed(url); doc.Declaration = new XDeclaration("1.0", "utf-8", "true"); var root = doc.Root; if (year == highestYear) …
rksprst
  • 6,471
  • 18
  • 54
  • 81
1
vote
3 answers

LinqToXML: Getting elements with given value

I have this xml-file: test foo bar Now, I want to query this xml, and retrieve all the…
Vegar
  • 12,828
  • 16
  • 85
  • 151
1
vote
2 answers

Linq to XML not getting a result

I am creating a List of structs using linq to xml. The linq path does not find the concept elements. I have tried various formulations of this and before I give up and use xpath I am hoping someone can show me the linq way. thanks Here is the xml…
Jules
  • 1,071
  • 2
  • 18
  • 37
1
vote
1 answer

How would be the query for this XML file?

I'm having a hard time trying to create the query. This is the file:
Darf
  • 2,495
  • 5
  • 26
  • 37
1
vote
3 answers

remove sections of XML document with Linq

How would i using Linq remove all section where their element contains parameter with {} ? In my example i want to remove section with {SecName1} Source document: Test…
user681055
  • 59
  • 11
1
vote
1 answer

Using LINQ to iterate through a database and generate a generic XML layout of schema + data

Is there an easy way to have LINQ iterate through each of the fields in a table and get field properties such as the field name? Basically, I want to just create a simple xml document that represents the db schema like so:
Fritz Fox
  • 13
  • 3
1
vote
2 answers

How do I retrieve data with Linq to XML?

I need to find ShippingMethod and the attribute Code and Destination from the following piece of XML: How do…
Sreedhar
  • 29,307
  • 34
  • 118
  • 188
1
vote
2 answers

LinqToXml; query where attribute does not exist

Is there syntax to state where attribute does not exist? Dim xe As XElement = _ Dim xe2 As IEnumerable(Of XElement) xe2 = From c In xe.
baileyswalk
  • 1,198
  • 2
  • 17
  • 29
1
vote
2 answers

Import XML to SQL using C#

I know it's not sporting asking for this kind of help, But I've been really stuck on this for a while - right now I am reading two C# books and working everyday over 9 hours. Okay here is my problem: I have a WinForms C# application that is almost…
adopilot
  • 4,340
  • 12
  • 65
  • 92
1
vote
4 answers

Linq to XML Query not picking anything

I have a rather complex XML document 0S57WGDPNC7T8HNBV76K
Joe Tyman
  • 1,417
  • 5
  • 28
  • 57
1
vote
2 answers

Accessing node text using C# and Xelement (Linq)

I have the below XML and I load into a XElement in VB.NET and I can get the value of C easily with the below statement but when I try in C#, I get an error with the .Value . How can I access the inner text of C with ease? I can't seem to work out…
MiscellaneousUser
  • 2,915
  • 4
  • 25
  • 44
1
vote
1 answer

How can I remove an xmlns from an element or avoid adding it when creating it

I need to create XM that looks like this.
spainchaud
  • 365
  • 3
  • 12
1
vote
3 answers

How to get an element from a node in XDocument where two other elements are known

I'm stumped (again) with an misunderstanding of XDocument/Linq. For the XML below, I have nameEn and provinceCode as variables in my code. I'm trying to identify the code (e.g., s0000002) and nameFr given I have the other two elements. The…
Doug
  • 61
  • 1
  • 7
1 2 3
99
100