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

XElement iteration won't work

I am trying to go through this XML: 86248040 1347274789 0 419
Clue
  • 119
  • 4
  • 15
0
votes
1 answer

Is it possible to use variable Tag Name in VB.Net XML Axis query

Is it possible to use variable tag name in VB.Net XML Axis query??? e.g. contacts.....Value Where "varTag" is variable name and the real tag name will be known at only runtime. Thanks.
wirol
  • 49
  • 1
  • 6
0
votes
1 answer

Unable to format Xml for Excel

im trying to format an XML-file so that its possible to open it directly using Microsoft Excel. The problem im having is due to both the default namespace and alias ss: namespace is the same. I can't make excel accept the file otherwise. When try…
user1029697
  • 150
  • 2
  • 9
0
votes
1 answer

Adding an XElement with and specify a namespace

I'm trying to use linq to read and modify some Excel XML, first I grab the Worksheet named Datagrid From there I select the first row (using Index) And now I want to find the cell in this row whose property is atrHeader Dim dg = From item In…
WhiskerBiscuit
  • 4,795
  • 8
  • 62
  • 100
0
votes
0 answers

Is returning an XElement considered as bad practice in C# RESTful services?

I would like to return a highly customised xml but the serialization of my objects does not let me manipulate the xml format, or at least I could not do it. So I was thinking about returning an XElement since it is possible. Would that be considered…
user1589780
  • 73
  • 2
  • 9
0
votes
1 answer

Child of an xElement within LINQ Query

How do I get an child element of an xElement in the example below: I am using LINQ to query some XML data, but I can't seem to get to the part of the XML from which I want the data. Here's my code so far: // Use LINQ to pipe the data in to…
Luke
  • 22,826
  • 31
  • 110
  • 193
0
votes
2 answers

Need method to return XElement instead of byte[]

I have the following method that I need to return an XElement. The problem is that can't figure out how to convert a byte[] into an XElement. public XElement ServiceCallForNewMadidPlantReport() { var kpiReportClient = new…
Programming Newbie
  • 1,207
  • 5
  • 31
  • 51
0
votes
1 answer

XDocument XElement.Descendants issue

I have a simple issue but I don't know how to fix it. I have an XML document that looks like this Now, in my code I have the following XElement hotel =…
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
0
votes
1 answer

Reading xml stream

Sorry to be asking such similar question again, I am trying to read the following XML document: ACTIVE 2.5
smiley
0
votes
2 answers

Remove parent from the XElement

how to remove the parent tag from the xml " Tickets" the remaining nodes should be there 2011-02-25 00:00:00 INC000000578057
user1021167
0
votes
2 answers

XElement/LinQ Code Failure

So I have the following code: public static void Replace(filepath) { try { XElement xD = XElement.Load(filePath); foreach (XElement xE in xD.Elements()) { …
gfppaste
  • 1,111
  • 4
  • 18
  • 48
0
votes
2 answers

Using XElement to edit attribute names

So I'm looking for a way to edit individual element descriptions in an XML file. For example, say I have: 1 Stack1 2 This Book 3 That Book 4 Another…
gfppaste
  • 1,111
  • 4
  • 18
  • 48
0
votes
1 answer

Generate xml attributes

I have to create an xml file, that contains an element with attributes like: I tried: XNamespace ns = "xsi"; var root = new…
L-Four
  • 13,345
  • 9
  • 65
  • 109
0
votes
2 answers

How to parse XElement with &, <, > symbols?

I have xml like this My test is 5 > 2 & 10 < 12 When I convert it to xElement var xe = XElement.Parse(xml); I get errors If xml contents & so I get this error «An error occurred while parsing EntityName» If xml…
podeig
  • 2,597
  • 8
  • 36
  • 60
0
votes
1 answer

Update xml where structure is unknown and different for each record

I need to update some xml where the structure is unknown, and I'm not quite sure where to begin. I have a field with some xml in a database table, and this can be different xml for each record. The associated schema is also stored in the…
annelie
  • 2,569
  • 6
  • 25
  • 39