Top "Linq-to-xml" questions

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

How do I do a deep copy of an element in LINQ to XML?

I want to make a deep copy of a LINQ to XML XElement. The reason I want to do this …

.net linq-to-xml
The given value of type String from the data source cannot be converted to type int of the specified target column

I am trying to read values from xml file and then use the bulkcopy to insert the data into my …

c# linq linq-to-xml sqlbulkcopy
How to convert XElement to XDocument

How can I convert XElement into XDocument? Is there some built-in method for this? The only way I can think …

c# xml linq-to-xml xelement
How do I get a NameTable from an XDocument?

How do I get a NameTable from an XDocument? It doesn't seem to have the NameTable property that XmlDocument has. …

c# xml xpath linq-to-xml
How do you create an indented XML string from an XDocument in c#?

I have an XDocument object and the ToString() method returns XML without any indentation. How do I create a string …

c# linq-to-xml
How to Read a specific element value from XElement in LINQ to XML

I have an XElement which has content like this. <Response xmlns="someurl" xmlnsLi="thew3url"> <ErrorCode>&…

c#-4.0 linq-to-xml xelement
Creating XDocument with xsi:schemaLocation namespace

I need to create the following XML and I'm trying to do this using XDocument. However, I'm having trouble specifying …

c# xml linq-to-xml xnamespace
How to specify an xmlns for XDocument?

I tried: textBox1.Text = new XDocument(new XDeclaration("1.0", "UTF-8", "yes"), new XElement("root1", new XAttribute( "xmlns", @"http://example.com"), new …

c# .net xml xml-namespaces linq-to-xml
How can I query an XDocument with a 'path'?

I would like to query an XDocument object for a given path, (e.g. "/path/to/element/I/want") but …

c# xml linq xpath linq-to-xml
C# XDocument Load with multiple roots

I have an XML file with no root. I cannot change this. I am trying to parse it, but XDocument.…

c# xml linq-to-xml