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

asp.net mvc setting XElement xml to empty

How can I do something like XElement xml =empty;
maztt
  • 12,278
  • 21
  • 78
  • 153
0
votes
1 answer

Changes are not getting saved - modify Track Changes Author in Header - OpenXML HeaderPart

Using C# in VS, I am trying to change the author name in track changes found in a word document header based on their dates. Using the debugger, it seems that the author's name is getting changed, but the document changes are not getting saved. I…
0
votes
1 answer

XElement Nodes and child nodes

I'm sorry for advanced if this question has been repeated, but from my search there hasn't been any appropriate answers for my particular error. So to the question, I've currently got an excel document with several rows of XML within the spread…
jsg
  • 1,224
  • 7
  • 22
  • 44
0
votes
1 answer

How to iterate all nodes?

I am trying to produce the following output:
....
....
I need little assistance with the looping logic - any advice where i may be going wrong. I tried using the "for"…
user3070072
  • 610
  • 14
  • 37
0
votes
2 answers

How can I use XElement to retrieve the Sum of an Attribute?

I've been using XElement to store information about files, and I would like to be able to sum all of the file lengths to get a total size of the files. I keep wanting the answer to be something like…
Scott Jore
  • 71
  • 8
0
votes
1 answer

Binding XElement to Datagrid

I'm trying out XElement binding for the very first time so apologies if this is very silly. I have an XML which I need to bind to DataGrid. Music.xml:
0
votes
1 answer

Extracting SPWeb.Groups.Xml in XElement

I need to get SPWeb.Groups.Xml in XElement to create XDocument. SPSite site = new SPSite(url); foreach (SPWeb web in site.AllWebs) { SPUserCollection spusers = site.RootWeb.SiteUsers; XElement xeGroup =…
BeHappy
  • 138
  • 2
  • 17
0
votes
1 answer

Select particular node and its value from XElement

I have below xml as XElement .
Roshan
  • 873
  • 12
  • 33
0
votes
2 answers

how can I dynamically add XElements to an XML file?

okay, so my program will be saving any number of XElements that are given by the user from a NumericUpDown control during runtime. The way I wrote this with XMLtextWriter is as follows: public void XMLWriteNewL4Module() { int i; …
0
votes
1 answer

Find the delta between two xelements using "except" C#

My first XElement is: XElement sourceFile = new XElement("source", from o in Version1.Element("folder").Elements("folders").ElementAt(0).Elements("folder") where o.Name != null && o.Name == "folder" …
Asaf
  • 3,067
  • 11
  • 35
  • 54
0
votes
2 answers

How to read xml file using VB.NET by using XElement parsing?

I am pretty new to parsing xml. I tried the solutions provided for similar questions but the xml I have is formatted in a different way. I have an xml file as below which comes from an external tool. I get this as a webresponse from the…
Kannan Suresh
  • 4,573
  • 3
  • 34
  • 59
0
votes
1 answer

Format XElement object

How can I format the contents of an XElement object? I know that the output string is automatically formatted when calling .ToString(), but I want to add the whitespace nodes before converting the objects to string. The intention is to format XML…
TWT
  • 2,511
  • 1
  • 23
  • 37
0
votes
1 answer

XElement.Elements(XName name) doesn't return a name that exists in XElement.Elements()

As you can see, the schema.Elements returns three elements one of whom is an EntityContainer element. But when I try to search thru the Elements overload specifying the "EntityContainer" (schema.) it doesn't retrieve anything.
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
0
votes
3 answers

Do not add XElement if value is 0

I am creating an XML (see function below): public static string CreteInvoice() { string _dc; Mark pm = new Mark(); XNamespace tu = "http://www.name.com"; var item = QueryDb.InvoiceHeader; …
Tagyoureit
  • 359
  • 1
  • 5
  • 18
0
votes
0 answers

To Deserlize SOAP XML to WCF service method from C# and How to get xatttibute and xelement value in soap xml

When i Deserlize soap xml, i am getting Status and Token attribute value Null.How can i solve this problem. How to assign xattribute and Xelement values in model.How to use xml serlize in wcf service. I have Soap XML below
prakash
  • 1
  • 3