Questions tagged [xmldocument]

The original .NET type that represents an XML document. The more modern version is XDocument.

XmlDocument is the original .NET type that represents an XML document. The more modern version is XDocument.

Use XmlDocument.LoadXml to load an XmlDocument from a string. Use one of the XmlDocument.Load methods to load from a file path or URL, Stream, TextReader, or XmlReader.

Using XmlDocument.Load with a string containing XML will lead to the common "Data at the root level is invalid" exception.

1239 questions
-1
votes
2 answers

Adding Root Node into response result XML using VBS

I need to add root element to response result xml. We are receiving xml result from another(2nd) application which is not having proper root element hence our(1st) application unable read "RETURN_CODE" whether it is success or not. Response from 2nd…
Shivam
  • 17
  • 2
-1
votes
2 answers

LINQ to read XML String and put into a variable

I am trying to read XML using LINQ. Previously I use XMLDocument to read but it gives an error and someone on StackOverflow encourage me to use LINQ. Below is the code i previously used for the XMLDocument string soapmessage = @"
Daniel
  • 109
  • 1
  • 13
-1
votes
1 answer

ASP.Net Core how to parse XML Request with ISO-8859-1 Charset

I am trying to create a web API that takes XML as an input. The problem is that the requests are encoded as ISO-8859-1. At first I tried just using an XmlDocument parameter but it gave a 500 error when the encoding was wrong: [HttpPost] public…
-1
votes
1 answer

How to I write the contents of XML file(XmlDocument) to text file?

I've xml data inside a local variable xml of type XMLDocument I wish to save the xml data as it is into a local file. I've tried something like System.IO.File.WriteAllText(@"C:\MyProfile\OutOut.txt", xml.ToString()); but doesn't work. Can someone…
m_beta
  • 132
  • 15
-1
votes
1 answer

Count number of child nodes for specific XML Node c#

I want to iterate through this XML-file (XmlDocument) and count the number of subnodes each Employee Element have. I want to Iterate through Employee with ID 1, count the number of sub nodes and then save it to a HashSet with the Employee ID as key,…
-1
votes
1 answer

Reading Data from XML and storing them into SQL Server database

I am developing a C# Windows Forms application. I am reading data from XML which is coming from a web API and storing that XML data into a SQL Server database. I am able to achieve this. But my only concern is, in a production environment, this…
-1
votes
3 answers

is it possible to alter the node value with xmlreader?

I'm reading in an XML stream that's approximately 100mb, and I'd like to replace values that are over 1mb. example input yes SDFSFDSDFfgdfgsgdf==(this is 5 mb) pdf
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
-1
votes
1 answer

XML Load repeated elements using c#

Is that possible to loop element with the same orientation of fields. 0062
user1852837
  • 4,441
  • 3
  • 16
  • 16
-1
votes
1 answer

Estimating the iteration element in c# for very large xml files

I am working with a multitude of different xml files where I do not know the iteration element within the file. What I mean with iteration element is the element that is repeated throughout the xml file (also seen in xsd-fiels as…
Dennis C
  • 71
  • 1
  • 13
-1
votes
1 answer

{"'\u0004', hexadecimal value 0x04, is an invalid character

I am trying to convert a file to XML format that contains some special characters but it's not getting converted because of that special characters in the data. I have already this regex code still it's not working for me please help. The code what…
Mos
  • 11
  • 1
  • 4
-1
votes
3 answers

How to get XmlElement from XmlNodeList in C#?

Below is sample of my XML file 100 200 300
WEAPI
  • 101
  • 4
  • 9
-1
votes
1 answer

"An object reference is required for the non-static field, method, or property"

i am stuck with this small problem in my code. I am trying to make small console application which will write into xml document. I have used xmldocument and xmlnode concept. ERROR i am getting is; *An object reference is required for the non-static…
Sangram Nandkhile
  • 17,634
  • 19
  • 82
  • 116
-1
votes
1 answer

How to remove a node from XmlDocument loaded XML

I have repeated xml fragment like this below in a larger document. How to remove all occurrences of well, total and fee using XmlDocument? asdf
v.g.
  • 1,076
  • 5
  • 19
  • 38
-1
votes
2 answers

XmlDocument parse using Node ID in C#

How to parse through XML file using a node Id. I want to get to 0.8988 node of USD/EUR 0.8988 5/27/2016
aadi1295
  • 982
  • 3
  • 19
  • 47