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

Convert XElement to Array

How should i convert XElement like below into an array of Points (Point could be a class with variables X and Y):
Masood Alam
  • 645
  • 2
  • 8
  • 22
0
votes
2 answers

How to read child category in XML

I want to read the DivaURI key's value but I couldn't do that. I tried lots of things. I want to reach to userProperties child category. And Finally want to read DivaURI key's value. Here is the one category XElement:
cihadakt
  • 3,054
  • 11
  • 37
  • 59
0
votes
2 answers

XElement Automatically Having xmlns attribute

Dim soapEnvelope As XElement = New XElement(soap + "Envelope", New XAttribute(XNamespace.Xmlns + "soap", soap.NamespaceName), New XAttribute(soap + "encodingStyle",…
HelpASisterOut
  • 3,085
  • 16
  • 45
  • 89
0
votes
1 answer

Failing on checking on existence of xml attribute in linq?

I have an list of "IEnumerable " all of the same elements: "elem1", that I got by IEnumerable childList = from el in sessionXML.DescendantsAndSelf().Elements("elem1") select el; childList:
jerryh91
  • 1,777
  • 10
  • 46
  • 77
0
votes
1 answer

Selecting Child Node of XElement with LINQ Group By

I have some xml in the form:
stormCloud
  • 983
  • 1
  • 9
  • 24
0
votes
0 answers

c# Compiler Says A Method Is Not There

I developed code in a single non-compiled .aspx page that ran great, but when I copy-pasted the code into a code-behind page the c# compiler is raising an error: error CS1061: 'System.Collections.Generic.IEnumerable' does not contain a definition…
MarkF
  • 952
  • 2
  • 8
  • 25
0
votes
2 answers

Assessing Xml node values with xmlnamespace

I am trying to access "shl:Value" node using c# but getting null or run time error. I like avoid using big loops. Code: XmlDocument objXmlDoc1 = new XmlDocument(); objXmlDoc1.Load("C:\\inetpub\\Jobtrain\\test.xml"); XmlReader reader =…
0
votes
1 answer

How do I remove the xmlns="" attribute added to newly created XElement nodes?

When I add new nodes to the root of a node that has a namespace defined, subsequent nodes added all receive xmlns="" attached to to them. This is the code that shows my problem: void Main() { var xdoc = new XDocument(); var shipmentRoot =…
Victorio Berra
  • 2,760
  • 2
  • 28
  • 53
0
votes
2 answers

Save XElement without affecting the current header

So, I'm loading the XElement of a document like this: Root = XElement.Load(Path); The original header looks like this: When I call Root.Save("file.xml"); it changes the header…
Luis Lavieri
  • 4,064
  • 6
  • 39
  • 69
0
votes
1 answer

XElement Path Validation

I am trying to validate Elements and Attributes exist in an XElement. Basically, I was wondering if anyone had a generic way to check if a give path is null. I don't have access to System.Xml.XPath (doing this for compact framework). Basically…
cw.
  • 109
  • 1
  • 7
0
votes
1 answer

How can I specify the XElement attribute prefix for an EF edmx view type?

Using C# on a Win7 machine I am needing to dynamically change the schema type on an Entity Framework 6.2 edmx xml file prior to instansiating EF. I can filter the edmx Xml for the "Schema" attribute for tables but not for views. Tables use the non…
Dave
  • 1,822
  • 2
  • 27
  • 36
0
votes
1 answer

Resolving xml namespace from attributes values

Given the following xml (simplified)
Benoittr
  • 4,091
  • 4
  • 27
  • 38
0
votes
2 answers

C# Read XML inside tag (Inner?)

Ok, I have a small issue reading one of my company's notorious malformed xml files. Trying to get 5 values from it and save them individually as variables. Here is an example of the tricky XML. (I may not be using the right terms, but I couldn't…
Redracer68
  • 958
  • 1
  • 7
  • 12
0
votes
1 answer

XMLDescendants to Object

I am parsing XML to create an object. I am just unsure as to how to cast the var lotConfig into a LotCOnfig object. I have tried : var lotConfig = (LotConfig) xml.Descendants("LOT_CONFIGURATON").Select( and return lotConfig as LotConfig But None…
user3774466
  • 23
  • 1
  • 4
0
votes
4 answers

How to put a self join with LINQ on XDocument?

I have XDocument randomly containing few records in this format : 21 leaf This course Dallas, US - August 19, 2013
foo-baar
  • 1,076
  • 3
  • 17
  • 42