Questions tagged [xmltextreader]
126 questions
113
votes
5 answers
Best Way to read rss feed in .net Using C#
What is the best way to read RSS feeds?
I am using XmlTextReader to achieve this. Is there any other best way to do it?
XmlTextReader reader = new XmlTextReader(strURL);
DataSet ds = new DataSet();
ds.ReadXml(reader);
After reading the RSS feed…

Tronics
- 1,438
- 4
- 22
- 33
45
votes
9 answers
Name cannot begin with the ' ' character
I'm parsing some XML in C#. I'm getting it from a database, and so converting it to a MemoryStream before reading it with an XmlTextReader. The problem is that I get this error: Name cannot begin with the ' ' character, hexadecimal value 0x20. Line…

Brian Hicks
- 6,213
- 8
- 51
- 77
23
votes
1 answer
How to read a xml string into XMLTextReader type
I have an XML string. I need to convert this string into XMLTextReader(System.Xml.XMLTextReader) type in dotnet.
I used the following code:
string szInputXml = "testing " ;
XmlTextReader reader = new…

osum
- 805
- 2
- 10
- 32
22
votes
2 answers
XmlTextReader vs. XDocument
I'm in the position to parse XML in .NET. Now I have the choice between at least XmlTextReader and XDocument. Are there any comparisons between those two (or any other XML parsers contained in the framework)?
Maybe this could help me to decide…

MarkusSchaber
- 757
- 1
- 8
- 16
13
votes
6 answers
Fixing bad XML file (eg. unescaped & etc.)
I got an XML file from 3rd party that I must import in my app, and XML had elements with unescaped & in inner text, and they don't wont to fix that ! So my question is what is the best way to deal with this problem ?
This XML is pretty big and that…

Antonio Bakula
- 20,445
- 6
- 75
- 102
13
votes
2 answers
C# Foreach XML Node
I'm saving 2-dimensional coordinates on an XML file with a structure similar to:
540:672
540:672
I can open the XML…

Gio Borje
- 20,314
- 7
- 36
- 50
8
votes
1 answer
How do I output XML as a string from an XmlTextReader into a Response.Write?
I have retrieved some XML from an API (at least I think so, the server response is 'OK') however I am putting the response stream into an XmlTextReader, how do I output this XML as a string?

MetaGuru
- 42,847
- 67
- 188
- 294
8
votes
3 answers
Using XmlTextReader
I am a beginner programmer starting off with C#, and web services.
In the Service.cs file of my web service, I create a ReadXMLFile() method where I am trying to read an existing XML file, take the data from it and place it to the corresponding…

Jess
- 121
- 2
- 2
- 4
6
votes
1 answer
XmlTextReader - Does it lock the file?
This is probably a really simple thing, but I haven't been able to find it, and I'm probably just searching for the wrong thing...
XmlTextReader --> Does it lock the file you're reading? I'm using reader.Read() and that's about it.

Matt Grande
- 11,964
- 6
- 62
- 89
6
votes
1 answer
XMLTextReader not reading an element content
static void ReadXml()
{
string a= null;
double b= 0;
double c= 0;
XmlReader xmlReader = new XmlReader("Testxml.xml");
xmlReader.
using (xmlReader)
{
if (xmlReader != null)
{
while…

Learner
- 980
- 7
- 20
- 37
6
votes
2 answers
Fast way to get number of elements in a xml document
is there a best practice to get the number of elements from an XML document for progress reporting purposes?
I have an 2 GB XML file containing flights which I need to process and my idea is to first get the number of all elements in the file and…
user459611
4
votes
4 answers
Reading a xml file multithreaded
I've searched a lot but I couldn't find a propper solution for my problem. I wrote a xml file containing all episode information of a TV-Show. It's 38 kb and contains attributes and strings for about 680 variables. At first I simply read it with the…

theknut
- 2,533
- 5
- 26
- 41
4
votes
1 answer
What's the path to the document cursor?
I'm using System.Xml.XmlTextReader the forward-only reader. When debugging, at any time I can check the properties LineNumber and LinePosition to see the line number and column number of the cursor. Is there any way I can see any kind of "path" to…

Colonel Panic
- 132,665
- 89
- 401
- 465
3
votes
6 answers
Large XML file, XmlDocument not feasible but need to be able to search
I am struggling with a sensible logic loop for stripping out nodes from an XML file too large to use with XPath supporting .NET classes.
I am attempting to replace the single line of code I had (that called SelectNodes with an XPath query string)…

J M
- 1,877
- 2
- 20
- 32
3
votes
1 answer
XmlTextReader passes end of XML document without recognizing
I'm trying to create a simple App which reads a XML using SAX (XmlTextReader) from a stream which does not only contain the XML but also other data such as binary blobs and text. The structure of the stream is simply chunk based.
When entering my…

Romout
- 188
- 2
- 8