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

RegEx To Make sure all attributes are valid

I am running into an issue in a .Net 3.5 site I inherited. The issue is the site uses XElements everywhere to render the content on some pages. But, I am noticing that with certain YouTube video embeds, I am getting errors stating that there is an…
Kevin
  • 2,684
  • 6
  • 35
  • 64
0
votes
1 answer

WPF Master -Detail Binding XElement

I have a XElement that has the following structure I have one Listbox named "documents" that is bound to an XElement in the following manner: ItemsSource="{Binding…
Rob Buhler
  • 2,469
  • 4
  • 27
  • 35
0
votes
2 answers

how to parse attribute out of this xml?

I've been trying to get out width and height out of this xml:
Alireza Mn
  • 75
  • 1
  • 8
0
votes
1 answer

XML reading with LinqToXml

I have an xml source which you may reach from: http://eft.tcmb.gov.tr/bankasubelistesi/bankaSubeTumListe.xml I would like to read this xml and parse it into my database but having difficulties with LinqToXml I tried many approaches but always…
Görkem Öğüt
  • 1,761
  • 3
  • 18
  • 29
0
votes
1 answer

Adding suffix to XmlElement C# parser

I'm dealing with a XML file which has support for different languages, I want to parse this XML into C# classes using XDocument/XElement (using System.Xml.Serialization). The XML is slightly complex but what I want to achieve should be simple, yet I…
0
votes
1 answer

Does XElement.Remove() function thread safe?

Does XElement.Remove() function thread safe?such as in Parallel.Foreach.and I can ensure the nodes in different threads are different.
TommyLike
  • 1,010
  • 11
  • 20
0
votes
1 answer

How to remove an element where all descendants are empty

I would like to remove all the rows from the root where all the columns are empty. data I have tried…
Scott
  • 1
0
votes
3 answers

NullReferenceException was unhandled error when trying to retrieve config attributes

public string GetLogName(string config) { XDocument xDoc = XDocument.Load(config); XElement[] elements = xDoc.Descendants("listeners").Descendants("add").ToArray(); foreach (var element in elements) { …
Pam
  • 63
  • 5
0
votes
1 answer

How do I sort elements by the attributes of the elements' children?

For an XElement like Is there a way to get a list of ordered by id values? I unsuccessfully tried bElements.OrderBy(function b As XElement) b.Elements.Attributes("id")) and…
Thalecress
  • 3,231
  • 9
  • 35
  • 47
0
votes
1 answer

XElement get start Tag string

Is possible to get the start tag string of an XElement? For example, if i have an xml element like this // .. // .. i…
Catalin
  • 11,503
  • 19
  • 74
  • 147
0
votes
1 answer

Appending new XElement adds an entire XML to existing xml in stream

I have an existing XML stored in the InternalFielStorage as.. I am trying to append a "title" node under the "Author" node but…
Sam
  • 25
  • 4
0
votes
1 answer

XML hidden characters, how to remove Bom

I am trying to create an XML file through code. The file is being created successfully but my system needed for the file only reads UTF-8. The file is not being loaded successfully as their are some hidden characters. This hidden characters are…
Mark Fenech
  • 1,358
  • 6
  • 26
  • 36
0
votes
1 answer

Using Linq to XML foreach to create muliple XElements

I'm building an XML file dynamically using new XElement(), and midway through the file creation I need to iterate over a set of child records and create XElements for them. The problem I'm having is that I need to create more than 1 XElement per…
markpsmith
  • 4,860
  • 2
  • 33
  • 62
0
votes
1 answer

How to make XElement.Parse Attributes with ? and slash symbols

I am attempting to use C# XElement to parse html. In HTML, src attributes have urls and query strings containing ? and / Is it possible to make them parsable?
Hoy Cheung
  • 1,552
  • 3
  • 19
  • 36
0
votes
2 answers

Unable access elements inside Xelement directly

I have this XML inside an Xelement object called request:
Popo
  • 2,402
  • 5
  • 33
  • 55