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

XML to create from an oracle query

I wrote below query to generate a xml file SELECT XMLElement("Providers", XMLElement("Provider" ,XMLAttributes( "Unique ID" as "UniqueId"), XMLElement("ProviderType",…
Sachu
  • 7,555
  • 7
  • 55
  • 94
0
votes
2 answers

Using C# to create objects parsing XML

I've spent 1.5 days trying to create an object parsing XML: Signer johndoe@gmail.com Doe, John
obautista
  • 3,517
  • 13
  • 48
  • 83
0
votes
1 answer

XDocument descendants is throwing a null reference

I've got an XML document like this: <?xml version="1.0" encoding="utf-16"?> <ArrayOfString…
derekantrican
  • 1,891
  • 3
  • 27
  • 57
0
votes
1 answer

Serializing an XElement that is a property of a class object

I've got a class that includes an XElement object... public class SomeClass { public string prop1 = ""; public string prop2 = ""; public XElement elem = null; } I'm setting the XElement property later in the code with an instance of…
0
votes
3 answers

Linq statement in C# to extract data from XElement

I have a List containing elements like this: { Path
0
votes
1 answer

XElement using Flags Enum

In my code, I have got an Flags Enum for days of the week, as follows: [Flags] public enum DaysOfWeek // enumeration for days of week { Sunday = 0x0000001, Saturday = 0x0000010, Friday = 0x0000100, Thursday = 0x0001000, …
StuartR143
  • 369
  • 2
  • 10
0
votes
3 answers

Get Xml content into a string from a subchild using c#

It is my first time posting, and I am very new to C#, so I appreciate the help. I have so many variations of this code that are close to what I need, but I can't get on my own. I am trying to get the contents of a sub-child in an XML sting using…
0
votes
1 answer

System.UnauthorizedAccessException in nested Stream calls

I am getting System.UnauthorizedAccessException in this function public static async Task> XMLDisplaySignals() { StorageFolder storageFolder = ApplicationData.Current.LocalFolder; StorageFile…
John P.
  • 1,199
  • 2
  • 10
  • 33
0
votes
1 answer

xml XDocument Save modify file

I am trying to add XElements to an XDocument. I am trying to move from using inifile to xml but I am having some issues here. This is my C# code: public static async Task> XMLHandling() { StorageFolder…
John P.
  • 1,199
  • 2
  • 10
  • 33
0
votes
3 answers

Create a List from XElements Dynamically

I am reading a bunch of XML files into a list (IEnumerable really) of XElements. Then I want to convert the XElement list (these XElements contain a bunch of child-elements) into a list of classes, so I can do later operations with the data more…
Sach
  • 10,091
  • 8
  • 47
  • 84
0
votes
1 answer

getting xelement to treat xml attribute value as CDATA

I am trying to include html content inside an attribute value (e.g. ). According to this, it seems that this should be done by default on string attribute types, however I get the invalid character error. Is there a…
Riz
  • 6,486
  • 19
  • 66
  • 106
0
votes
1 answer

Appending Xelement to Xdocument

I have the following xdocument , I am trying to append item elements within the items element with the following code: xdocument.Root.Element("items").add(item) This does not work as the items element can not be found. I think it is a problem with…
fedor333
  • 45
  • 9
0
votes
1 answer

XElement multiple root elements

I have below XML format to Create by XElement class In Which you can see I have two parent node Service and Catalog. Now when I read from source below is code snippet XElement rootElement = new XElement("Catalog", new XElement("Service"));//Create…
Troy
  • 11
  • 3
0
votes
1 answer

"context instance" for a XElement linq to XML query using a where clause

I want to return a list of string values from an XElement collection and I get this error when constructing my code and don't see what I'm missing. Here's a section of the class I've written concering the problem: private XElement…
maynard
  • 77
  • 1
  • 13