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

Checking for null values if element does not exist

I am getting values for a number of elements in a .resx file. On some of the the data elements the child element does not exist so when I run the following I will get a NullReferenceException. foreach (var node in…
Paolo B
  • 3,026
  • 5
  • 21
  • 43
0
votes
1 answer

Read each node in IEnumerable using XMlReader

I have IEnumerable theTestCaseNodes which has the following kind of XElements
Goto xxxxxxxxx
Diana
  • 49
  • 1
  • 7
0
votes
2 answers

orderby with LINQ

I am using LINQ and want to make a list order descending. I try it like this: XElement Icecreams = new XElement("Icecreams", new XElement("Icecream", new XComment("Cherry Vanilla Icecream"), new XElement("Flavor", "Cherry…
LikeToDo
  • 319
  • 1
  • 4
  • 13
0
votes
2 answers

How to get enclosure url with XElement C# Console

I read multiple feed from many sources with C# Console, and i have this code where i load XML From sources: XmlDocument doc = new XmlDocument(); doc.Load(sourceURLX); XElement xdoc = XElement.Load(sourceURLX); How to get enclosure url and show as…
Mister XP
  • 63
  • 1
  • 1
  • 9
0
votes
1 answer

How to check for enclosure tag with C# Console multiple rss Feed reader

i Have created C# Console application which read multiple RSS Feed urls, then take values and put in database. Now i have problem usualy with wordpress rss feed generator where article image is with tag enclosure. How to take and parse article image…
Mister XP
  • 63
  • 1
  • 1
  • 9
0
votes
1 answer

Get the data of xelement in c#

I have this xml as you can see : 0 0 0 0
Ehsan Akbar
  • 6,977
  • 19
  • 96
  • 180
0
votes
1 answer

Creating a child class of XElement that still keeps a reference to the original XElement and preserves the tree structure

To start things off, let me explain that I'm working with a class that inherits the XElement class. The new class is called MXElement. It adds some new functionality to it for navigating through the XML tree, as well as some more information…
ashays
  • 1,154
  • 1
  • 12
  • 30
0
votes
2 answers

Retrieving a sibling xml element

I have a set of xml elements that are siblings 1 1 1 1 1 1 XElement y is currently pointing to Element e. I now want to look at Element b. The code var y = e.ElementsBeforeSelf("b"); does return a…
Chuck Bland
  • 255
  • 1
  • 2
  • 13
0
votes
3 answers

Get specific values from XML with ID values

I have next XML file:
0
votes
2 answers

How do I find a specific XML attribute in a specific place in an XDocument

I have an example of my XML below (which i'm converting from SGML to XML prior to the check but that's besides the point). The XML IS valid at the point of checking. I need check the XDocument and find out if any of the elements contained…
Daedalus
  • 539
  • 2
  • 6
  • 16
0
votes
1 answer

IEnumerator behaviour

I use the following program to enumerate elements in the xml input. When the final element is reached x.MoveNext() returns false and this part is clear. My questions are: Why does it keep on printing even though the list is exhausted Why…
Pasato
  • 153
  • 9
0
votes
3 answers

How do I properly loop through all XML nodes?

I have an XML document which I would like to use the attributes from each node with a structure like so:
h01001000
  • 261
  • 8
  • 20
0
votes
1 answer

C# Linq to XML Element

Working on an issue where I can't seem to step through the elements and convert the date value as a datetime from the xml then print out all elements where the date is greater than "x" date to the console. The XML file is rather large, but here is a…
0
votes
2 answers

How to read multiple sub tags from xml limited which has recursive subtags?

I have an xml which has multiple tags. Example: abc T A abc T I want to read tags associated only with the first code i.e…
0
votes
1 answer

Convert Xml String with node prefixes to XElement

This is my xml string string fromHeader= "http://ex1.example.org/"; I want to load it into an XElement, but doing XElement.Parse(fromHeader) gives me an error due to the 'a' prefixes. I tried the…
joedotnot
  • 4,810
  • 8
  • 59
  • 91