Questions tagged [system.xml]

System.Xml is a set of APIs that provide support for processing XML in .NET applications.

System.Xml is a set of APIs that provide support for processing XML in .NET applications. https://learn.microsoft.com/en-us/dotnet/api/system.xml

101 questions
42
votes
5 answers

Why did I get an error with my XmlSerializer?

I made a couple of changes to my working application and started getting the following error at this line of code. Dim Deserializer As New Serialization.XmlSerializer(GetType(Groups)) And here is the error. BindingFailure was detected …
Doug
  • 1,991
  • 4
  • 25
  • 35
14
votes
2 answers

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 StackOverflow can. Why did Microsoft choose to remove the GetAttribute helper method on XML elements? In the System.Xml world…
John Lewin
  • 6,050
  • 4
  • 22
  • 20
11
votes
0 answers

Assembly Binding Error: Unrecoverable error occurred during pre-download check (hr = 0x80070780)

I have a .NET 4.5 application that works and runs with no issues in most environments; however, one area of the application throws a runtime assembly reference error on some client machines: Could not load file or assembly 'System.Xml.Linq, Version…
Bobby Byrnes
  • 411
  • 5
  • 18
6
votes
2 answers

XML bomb (Entity Injection) is by default taken care in .Net 4.0 but not in .Net 3.5. How? What changed?

Following code XmlDocument xdoc = new XmlDocument(); String xml = @"" + "" + …
user961954
  • 3,214
  • 2
  • 17
  • 24
4
votes
1 answer

How to deserialize a list of objects where the children are directly in the root

Consider the following XML: I've got the following code set up: private static void Main(string[] args) { …
Anemoia
  • 7,928
  • 7
  • 46
  • 71
4
votes
0 answers

.Net 4.0 System.Xml.dll different versions?

I was trying to use the Dispose method of the XmlReader but it seemed it wasn't available. After looking around on the internet, I found out that in .Net 2.0 the IDisposable.Dispose method was implemented explicitly, but that this was "corrected" in…
Marc
  • 983
  • 2
  • 12
  • 28
4
votes
3 answers

How to create a new System.Xml.Linq.XElement with PowerShell

I want to create an XML DOM programmatically using the System.Xml.Linq objects. I'd rather not parse a string or load a file from disk to create the DOM. In C# this is easy enough, but trying to do this in PowerShell does not seem possible. Option…
saveenr
  • 8,439
  • 3
  • 19
  • 20
4
votes
1 answer

System.Xml.Xpath not found

I tried to include System.Xml.Xpath in C#.NET to do wp7 programs for parsing XML. I have added the reference System.Xml but Xpath is not found.
Shrikanth
  • 301
  • 4
  • 13
3
votes
2 answers

Custom module conditional configuration optons

I would like to programmatically enable or disable specific options for a custom module on the administration panel depending on the status of a select. For example, if I had a Yes/No select something like do you want to handle stuffs? < select…
Matteo
  • 1,107
  • 2
  • 27
  • 47
3
votes
1 answer

What is the .NET 4.6 equivalent of VB6 MSXML2 nodeTypedValue?

I have been tasked with upgrading an ancient application that was written in VB6 to VB.NET/.NET Framework 4.6. The program does quite a bit of XML parsing, most of which I have been able to convert to using the System.Xml library however I can't…
Mythikos
  • 119
  • 12
3
votes
1 answer

Error: Attribute and namespace nodes cannot be added to the parent element

I'm getting the following error when trying to do a transform: Attribute and namespace nodes cannot be added to the parent element after a text, comment, pi, or sub-element node has already been added. Below is the function I'm using to do the…
CBC_NS
  • 1,961
  • 4
  • 27
  • 47
3
votes
1 answer

Insert child element in the right order when working with OpenXML

I'm modifying .docx documents with DocumentFormat.OpenXml library. I know element ordering is important, otherwise the document will not pass schema validation and might result a document that can't be opened in Word. Now I need to add a…
trailmax
  • 34,305
  • 22
  • 140
  • 234
3
votes
1 answer

What is an intuitive way to move an XmlNode from one XmlDocument to another?

I have two XmlDocuments and I would like to move an XmlNode selected from one of the documents and append it at a particular location in the other document. The naively intuitive approach of simply calling AppendNode(xmlNodeFromDocument1) at the…
Michael Lang
  • 2,157
  • 3
  • 22
  • 29
2
votes
1 answer

How to make object immutable yet serializable with System.Xml.Serialization in C#?

In my app I have a lot of XMLs to serialize from, so I have created quite a lot of models, to serialize to. I use System.Xml.Serialization, so it needs parameterless constructor and public access to properties to write deserialized data to. Now, I…
Adam Kaczmarski
  • 338
  • 1
  • 12
2
votes
1 answer

What assembly does XmlDocument live in, and how do I use it?

I have the following code: using System.Xml; namespace MyApp { public class Foo : IBar { public void SomeCallback(object sender, CallbackEventArgs e) { string s = e.Result; System.Xml.XmlDocument xml; // <-- Error CS0234. …
i_am_jorf
  • 53,608
  • 15
  • 131
  • 222
1
2 3 4 5 6 7