Questions tagged [xelement]

XElement is part of System.Xml.Linq in .NET Framework. This class represents an XML element, the fundamental XML construct.

An XElement has an XName, optionally one or more attributes, and can optionally contain content.

An XElement can contain the following types of content:

  • XElement
  • XComment
  • XProcessingInstruction
  • XText

Reference: XElement Class on MSDN

883 questions
0
votes
1 answer

C# XElement Load get Element Value

I have the following XML but struggling to get the DisplayName text, it keeps saying its a null value:
0
votes
1 answer

How I can collect similar xml tag to groups with Xml.Linq in c#?

I have a xml file with this style
Morteza Asadi
  • 1,819
  • 2
  • 22
  • 39
0
votes
0 answers

XElement.Parse breaks due to an invalid xml text

Today I noticed XElement.Parse is not working for a case in my application and throwing an exception. Then turns out an invalid character (in this case &) was the cause. I had a line as follow in my xml string:
0
votes
2 answers

How does one increment/update integer value of an XML Attribute in C# (XAttribute)?

TL;DR: If I have an XAttribute of NumFruits in an XElement, how can I increment/update the value from 0 to 1,2,3... ? The issue: When I attempt to increment the XAttribute like so: basket.Attribute("numFruits").Value += 1 the result for…
matrixanomaly
  • 6,627
  • 2
  • 35
  • 58
0
votes
4 answers

Getting address data from Google Maps XML

I've extracted some addresses from google maps and they are in an xml file. In myxml file I have some xelements like , , , etc The 'adr_address' element has different classes and each class contains, city, street,…
chuckd
  • 13,460
  • 29
  • 152
  • 331
0
votes
1 answer

How to write List items into an xml file?

I need to write items in the List myList into an xml file. The way the xml file should look like is if the values in the list are 1, 2 and 3. I know this is possible using linq. I want to avoid the serializer options.
Alfred Waligo
  • 2,809
  • 3
  • 18
  • 26
0
votes
1 answer

Xelement node remove

abcd efgh.

abcdefghijklmnopq.

yyyy xxxxxx
Chat
  • 185
  • 1
  • 5
  • 15
0
votes
2 answers

Convert an XpathNodeIterator to a List

In C#, I sorted an RSS feed using XpathExpression and a self defined compare function for the field Publication Date. I need to convert this sorted XPathNodeIterator object to a List 'Generic Linq type' object. I've tried to use an…
C-Jay
  • 11
  • 4
0
votes
2 answers

Avoid xml escaping of angle brackets, when passing xml string to System.Xml.Linq.XElement

I'm getting a string from string GetXmlString(); this I cant change. I have to append this to an xml within a new XElement ("parent" , ... ); , to the ... area. This string I'm getting is of the following format.
Dhanushka Dolapihilla
  • 1,115
  • 3
  • 17
  • 34
0
votes
2 answers

Create XML from multiple CSV's in multiple folders

The whole point of what I am doing is I need to create a master XML from multiple CSV files located in multiple subfolders within one master folder. This is what I am using right now, but it seems to overwrite and creates an xml for only the last…
Bnaffy
  • 129
  • 3
  • 14
0
votes
1 answer

c# Reading XML with XElement

When I run the following code and step through it with a break point and look at temp I see "Empty, Enumeration yielded no results" and the MessageBox.Show never fires. I'm trying to pull everything under Season no="1" XElement sitemap =…
Jrow
  • 1,026
  • 2
  • 12
  • 31
0
votes
0 answers

how to read soap incoming requests

Whiz Kid
  • 89
  • 1
  • 2
  • 6
0
votes
1 answer

streaming XElements oddity when there's no whitespace

I've run into a problem with streaming XElements and when there's no whitespace. Given the following code from MSDN documentation about streaming XElements, public static IEnumerable StreamElements(Stream source, string elementName) …
enorl76
  • 2,562
  • 1
  • 25
  • 38
0
votes
1 answer

XElement to List in c#

I want to convert XElement to my Object List. I have "Car" object and in help function i create XElement When i convert it with linq i get empty List. here is what i wrote: public class Car { public int row{ get; set; }; public int seat{…
tokenaizer
  • 208
  • 1
  • 5
  • 17
0
votes
2 answers

Insert XElement into value of another XElement

I have an XDocument object which contains XHTML and I am looking to add ABBR elements into the string. I have a List that I am looping through to look for values which need to be wrapped in ABBR elements. Lets say I have an XElement which contains…
rf_wilson
  • 1,562
  • 5
  • 32
  • 44