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

Error using XElement.Parse

I have a XML configuration for Query CAML:
Kiquenet
  • 14,494
  • 35
  • 148
  • 243
0
votes
2 answers

Cant go deeper than root, LINQ to (Funds)XML, C#

I'm working with a specific FundsXML-Schema trying to get all Assetss of a specific XML-File to iterate through. Short example of xml-file:
ZonRian
  • 3
  • 2
0
votes
1 answer

How to add XML namespace values using XElement, XAttribute

Here is the desired (required) output:
0
votes
1 answer

How to round-trip "invalid XML characters" - aren't character references valid/applicable?

The following two code samples demonstrates this issue I am encountering where "invalid characters" are not encoded or decoded. var elm = new XElement("foo", "\x12") elm.ToString(); // ArgumentException: '', hexadecimal value 0x12, is an invalid…
user2864740
  • 60,010
  • 15
  • 145
  • 220
0
votes
2 answers

Formatting an elements text using descendants of XElement

Im wondering how to select a specific element from the heirarchy so that I can format its text. In the example below I would like to format the specific element to remove the time portion of the date, but I am also looking for a way to format any…
Master Yoda
  • 4,334
  • 10
  • 43
  • 77
0
votes
2 answers

How to travel into an ArrayOfXelement?

I get an ArrayOfXelement for a result by a webservice. But now I wish to bind this data into a chart in Silverlight also I need to create a datatable. My question is how to travel my ArrayOfXelement ? Any ideas ? Linq to XML ? Regards. Narglix
user301089
  • 115
  • 3
  • 10
0
votes
2 answers

Foreach loop will not read XML

I am trying to read some data from an XML. I am using the same code in another application with an almost identical XML layout which seems to work.. But I cannot get any of the code to run inside the foreach loop with this code: It seems to read the…
Dan Sewell
  • 1,278
  • 4
  • 18
  • 45
0
votes
1 answer

How to extract all nodes of same level

I am trying to get all folder caption attribute and want to store in list Below is my XML File
Nadeem Khan
  • 1
  • 1
  • 3
0
votes
2 answers

How to get the inner text from an xml document using XDocument and extension methods

I am trying to get the "NAME" and "EMAIL" texts from the following html file:
Tom
  • 510
  • 1
  • 7
  • 24
0
votes
1 answer

How to add an element with attributes into an existing Xelement?

Hello I want to dynamically add the branch element which you can see in the XML code down 1 to N times to the code. This will depend on the numbers of branches the company is in. /> But I did not find…
steve
  • 123
  • 1
  • 14
0
votes
1 answer

Empty xmlns is created

I add an Xelement to a parent Xelement: rootElement.Add(schemaRootTag); The new XML element has an empty xmlns attribute like: xmlns="". Any ideas?
user3165438
  • 2,631
  • 7
  • 34
  • 54
0
votes
1 answer

Does XElement.Parse escape special characters

Assume i got code below, where xmlElement.AddAfterSelf(XElement.Parse(sbXml.ToString())); xmlElement : and XElement that contains a parent tag sbXml : StringBuilder with the xml string something like this
Deeptechtons
  • 10,945
  • 27
  • 96
  • 178
0
votes
1 answer

Carriage return in XElement

I want to produce an XML file where carriage return in elements are represented by the following sequence but I'm unable get: Hello world! If I do the following: var elem = new XElement("elem", "Hello\nworld!"); It…
Martin Delille
  • 11,360
  • 15
  • 65
  • 132
0
votes
1 answer

Get another attribute on the same element by searching another attribute

This might be the simplest question for that i appologise. This is part of my xml. What i want to get is the attribute "Value" based on another attribute "ItemOID". IE when ItemOID="I_MEDIC_HISTORY_INDICATION" what is the value.
user3276223
  • 59
  • 1
  • 8
0
votes
1 answer

Find translation unit pairs in tmx file

I have a Translation Memory which is essentially an XML file based on Translation Memory eXchange format specifications and I am trying to find a specific translation unit for editing. This is an example of the structure:
smuzoen
  • 199
  • 14