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

Getting xml node attributes and assign them to controls

I want to read certain nodes' attributes and for every certain node, i would like to create a radio button and assign those attributes to radiobutton.content. **SAMPLE XML** A B…
0
votes
2 answers

how to iterate through intersection of nodes

How can I iterate only through the common nodes between two documents? Right now, I am able to iterate through all the nodes of my document: var xmlBody = @" ... ...
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
0
votes
2 answers

How do I create an XElement that contains a prefix without a wrapper?

I'm trying to create a simple empty XElement like this: I have the namespace defined above: XNamespace dyn = "https://www.abc.at/dyn"; But when I create the XElement: XElement…
greenfeet
  • 677
  • 1
  • 7
  • 27
0
votes
1 answer

How to get XElement with xml Descendants into SQL Server

I need help to get my XML Elements using XElement into SQL Server. When I run the code the MessageBox.Show(element.ToString(), "element.value"); is displaying the 1234567 and 05/02/2018…
ChrisR
  • 81
  • 9
0
votes
0 answers

Convert string to XElement in Windows Ce C#

I am writing an application with C# for Windows CE. I want to convert the data read from a XML ( in string format) to XElement format and then set it to a meter. I have used XElemenet.parse() to convert my data. But when I want to set my data I get…
Mah Fa
  • 13
  • 4
0
votes
1 answer

How to process the XML file having hierarchical structure to get the inner details

I have a large xml file with following structure.This is a snippet which contains many nodes.
peter
  • 8,158
  • 21
  • 66
  • 119
0
votes
1 answer

C# junk characters break XElement "pretty" representation

I have occasionally run across XML with some junk characters tossed in between the elements, which appears to be confusing whatever internal XNode/XElement method handles prettifying the Element. The following... var badNode = XElement.Parse(@"+ …
b_c
  • 1,202
  • 13
  • 24
0
votes
1 answer

Modifying an XML Document Using C# Linq

I have an application that loops through an XML then downloads the files from the urls in the file My XML format is like this: MyFile
0
votes
1 answer

C# - From NetworkStream to XElement managing different encoding

I've an application that search XML over the network (using TcpClient), these XML have various encoding (one site in UTF8, other in Windows-1252). I would like encode all of these XML in UTF-8 (always) to be sure I'm clean. How can I do the…
Arnaud F.
  • 8,252
  • 11
  • 53
  • 102
0
votes
2 answers

I want to return the only/single string value from an XML Element using Linq

I want to return the latitude node (for example) from the following XML string (from Yahoo geocoding API.) 0 No error us_US 60
Seth Spearman
  • 6,710
  • 16
  • 60
  • 105
0
votes
3 answers

C# determine if one of child elements has specific value in XElement

Please consider this XML: 0 0 0 0 1 0 0 0 How can I write a lambda expression to find if one of child of MyRoot has 1 for…
Arian
  • 12,793
  • 66
  • 176
  • 300
0
votes
3 answers

How do I return an XElement with LINQ to XML?

I am simulating a web service that will return an XElement. The service makes its XElement from a database. In order to have a local test service I have created an XML Document which simulates a list of XML Elements. I wish to select and return one…
One Monkey
  • 713
  • 3
  • 9
  • 24
0
votes
1 answer

read multiple Xelements in C# from a XML file

I'm currently looking for a way to read attributes from multiple XElements into an array, but I couldn't figure out how. My XML file looks like this:
0
votes
1 answer

C# - Append an XElement array to XElement

I have a c# application, where I'm doing a data compare of two xml files inside a method called RevisionTree. I return a list of elements(XElement) from this method. From the BuildXml method, call that method and save the list as tree. Next I create…
AJ_
  • 3,787
  • 10
  • 47
  • 82
0
votes
1 answer

Filtering XElements by descendent element's attributes

I'm trying to select elements based on the attributes of sub a element of that element. Original Xml: XXXX XXXX XXXX
Martinffx
  • 2,426
  • 4
  • 33
  • 60