Top "Xelement" questions

XElement is part of System.

Innertext from XElement?

I'm having a hard time getting the correct value from the innertext of an XElement. First, here's the XML that …

c# xml xelement
How to add an existing Xml string into a XElement

How to add an existing Xml string into a XElement? This code var doc = new XDocument( new XElement("results", "<…

.net xml xelement
How to add child element to XElement as a decoded string?

I want to make pass this test. What should I use instead of Add method? [TestMethod] public void AddContentWithoutEncoding() { var …

c# .net xml linq-to-xml xelement
XElement value in C#

How to get a value of XElement without getting child elements? An example: <?xml version="1.0" ?> <someNode> …

c# xml xelement
Why doesn't XElement have a GetAttributeValue method?

Sometimes I'd like to know the reasoning of certain API changes. Since Google hasn't helped me with this question, maybe …

c# linq xelement system.xml
Remove xmlns attribute with namespace prefix

This question is a logical continuation of this one - now suppose an XElement contains elements in a non-default namespace: &…

c# xml vb.net xelement
How to best detect encoding in XML file?

To load XML files with arbitrary encoding I have the following code: Encoding encoding; using (var reader = new XmlTextReader(filepath)) { …

encoding linq-to-xml xmlreader xelement
using XElement to query for a node in namespace

i'm trying to pull out a node from a csproj file that looks like this, but can't get it to …

c# namespaces xelement
xElement Linq Creating List

I have created new class to read the data from xml file, which looks like : public class Validations { public string …

c# xml class xelement
Creating XML with namespaces and schemas from an XElement

A longwinded question - please bear with me! I want to programatically create an XML document with namespaces and schemas. …

c# schema namespaces xelement