Top "Linq-to-xml" questions

LINQ-to-XML provides a SQL-like query experience for navigating, parsing, and aggregating data stored in XML documents.

xml error: Non white space characters cannot be added to content

I am trying to open an xmldocument like this: var doc = new XDocument("c:\\temp\\contacts.xml"); var reader = doc.…

xml c#-4.0 linq-to-xml
How do I make the value of an XElement be wrapped in ![CDATA[***]]?

This is when using XDocument from .net. I thought this might work... xElement.Element(elementName).Value = new XCData(value).ToString(); ... …

c# .net xml linq-to-xml
LINQ to XML: how do I get only direct descendants of an XElement?

Dim xml = <Root> <Parent id="1"> <Child>Thomas</Child> </Parent> <…

.net xml vb.net linq-to-xml
How to remove xmlns attribute from XDocument?

In my C# codebase, I have an XDocument of the form: <A> <B> <C xmlns=…

c# linq-to-xml xml-namespaces
System.Xml.XmlException: Unexpected end of file while parsing Name has occurred

I'm using an XmlReader retrieved using SqlCommand.ExecuteXmlReader. Here is my input When I run this line of code: XDocument …

c# xml linq linq-to-xml xmlreader
Performance: XDocument versus XmlDocument

I have read a comparison between the two here. This is primarily a question of performance, relating to both memory …

.net xml performance linq-to-xml xmldocument
"The ':' character, hexadecimal value 0x3A, cannot be included in a name"

I have a code which will read some xml file(s). I tried different ways to solve this problem, but …

c# xml linq-to-xml infopath
How can I remove empty xmlns attribute from node created by XElement

This is my code: XElement itemsElement = new XElement("Items", string.Empty); //some code parentElement.Add(itemsElement); After that I got …

c# .net xml linq-to-xml
How can I write xml with a namespace and prefix with XElement?

This may be a beginner xml question, but how can I generate an xml document that looks like the following? &…

c# xml linq-to-xml
Convert single XElement to object

I have a single XElement looking like this: <row flag="1" sect="" header="" body="" extrainfo="0" /> Then I have a …

c# .net xml linq-to-xml xelement