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
1
vote
0 answers

C# Windows Phone XML.Linq - populate static variables

I've recently jumped into C# & windows phone apps, and I'm currently working on a user login system. The login, registration etc works with some simple web-calls. I want to create some global variables; username, email, id and isAdmin. I've used…
1
vote
2 answers

How to prevent adding XML element if XElement is Null?

I have a simple XML document that looks like this: LastName1 FirstName1 MiddleName1 Suffix1 However I have a constraint where I am not…
atconway
  • 20,624
  • 30
  • 159
  • 229
1
vote
2 answers

Search a value in XELement

I have a tree in form of XML that stores it in XELement variable.How I can search a value in All Nodes in this XML and if it exists return true?
Arian
  • 12,793
  • 66
  • 176
  • 300
1
vote
3 answers

Parse xml with XElement

I have this XElement : http://gdata.youtube.com/feeds/api/videos/s1tAYmMjLdY Wed, 17 Jun 2009 05:23:10 +0000
YosiFZ
  • 7,792
  • 21
  • 114
  • 221
1
vote
1 answer

How To Get Certain Parent Element Node When Child Condition Found

I'm having problems writing a C# script that'll get me a certain parent element of a given child element. To clear things up, this is an example of the XML tree. A
1
vote
1 answer

Query specific element in XElement

I have this code that I'm trying to tweak to get back just the messages element: public static void Main(string[] args) { Console.WriteLine("Querying tree loaded with XElement.Load"); Console.WriteLine("----"); …
jared
  • 1,344
  • 4
  • 20
  • 38
1
vote
1 answer

How to get particular tcm uri based on description in Tridion using core services?

I get the list of all users in XElement in Tridion using core services. Now I want to search for a particular user's tcm uri based on the decription?
Aquarius24
  • 1,806
  • 6
  • 33
  • 61
1
vote
0 answers

creating a XML file from a CSV

I am new to C# and all ive been coding have been filewatchers that would trigger and event when a certain file appears in the folder but recently i have been given a task to generate an XML file from a CSV file. Ive done some googling and i did find…
Pete Szeto
  • 11
  • 2
1
vote
2 answers

using StreamReader to read XElement leaves open elements

I have a MemoryStream that contains XML which I write to a file as follows: var xml = XElement.Load(data.Content); // data.Content is of type `Stream` var contentElement = new XElement("Content", xml); var information = new…
Noich
  • 14,631
  • 15
  • 62
  • 90
1
vote
1 answer

How can I get a node from an XML document based on its attribute value and into an XElement object?

I need to inject some XML into a pre-existing XML file under a certain node. Here is the code I have to create my XML: //Define the nodes XElement dataItemNode = new XElement("DataItem"); XElement setterNodeDisplayName = new…
Dbloom
  • 1,302
  • 3
  • 18
  • 45
1
vote
3 answers

XML in foreach loop from dataset in C#

I have to create a very specific shape XML file dynamically within C# to power a flash object on a website. The problem I have faced with many of my attempts is that most output wants each node to have some way of unique identification, I do not…
JCanlett
  • 23
  • 1
  • 4
1
vote
2 answers

Creating an XML element with a prefix using XElement

I have an application that makes use of a canvas that contains several WPF custom components. I'd like to export these components into a XAML file so that it can be fetched by another application but, in order to do that, I need to add prefix…
Nacho1984
  • 111
  • 6
  • 17
1
vote
1 answer

How can a WCF XElement Response include the XML Declaration?

I have a WCF service that is returning an XElement, this is working fine however I would like it to include the XML Declaration in the response: The client side is not something that I can change and is…
Luke
  • 6,195
  • 11
  • 57
  • 85
1
vote
1 answer

parsing CDATA in XElement

I am trying to parse an XML with CDATA elements...my below code blows up if content in CDATA is xml encoded...is there any way i can decode all the xml before i parse.. ---Code to parse if (formText.FirstNode.NodeType == XmlNodeType.CDATA) { …
srjt
  • 316
  • 2
  • 10
1
vote
1 answer

Inserting records into an XML table with a unique key

Maybe I'm just spoiled by SQL, but is there some cool LINQ way to insert a new record into an "XML table" and have the indexed ID update automatically (or at least semi-automatically)? Here's what I mean by "XML table":
devuxer
  • 41,681
  • 47
  • 180
  • 292