Questions tagged [xmlreader]

xmlreader - Represents a reader that provides fast, noncached, forward-only access to XML data.

Represents a reader that provides fast, noncached, forward-only access to XML data.

More

1120 questions
6
votes
2 answers

Getting PHP's XMLReader to not throw php errors in invalid documents

I'm in the process of writing a parser, and trying to do good error handling with exceptions. The following sample code: XML; $reader = new XMLReader(); $reader->xml($xml, null, LIBXML_NOERROR |…
Evert
  • 93,428
  • 18
  • 118
  • 189
6
votes
2 answers

php xmlReader vs xmlparser

I know the difference between xmlreader and other tree based parsers like simplexml and dom. But what is the difference between xmlreader and xmlparser? Is there any benefit in using one over another? I need to parse relatively big xml files,…
neonib
  • 61
  • 4
5
votes
2 answers

Is there an XmlReader equivalent for HTML in .Net?

I've used HtmlAgilityPack in the past to parse HTML in .Net but I don't like the fact that it only uses a DOM model. On large documents and/or those with heavy levels of nesting it is possible to hit stack overflow or out of memory exceptions. Also…
RobV
  • 28,022
  • 11
  • 77
  • 119
5
votes
2 answers

XmlReaderSettings.Schemas.Add() : The URI prefix is not recognized

I upgraded my old application in .Net 4.5. There are some obsolete methods warnings I was getting so thought to resolve them. One of the obsolete methods is XmlValidatingReader. Looked up on the internet and found that XmlReaderSettings is a…
Dinav Ahire
  • 581
  • 1
  • 10
  • 30
5
votes
1 answer

Android: why use XMLReader?

Is there any reason why I should use a XMLReader with the SAXParser? I'm seeing this kind of usage quite a lot: sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); LoginContentHandler uch = new LoginContentHandler(); …
user393964
5
votes
1 answer

Java XMLReader not clearing multi-byte UTF-8 encoded attributes

I've got a really strange situation where my SAX ContentHandler is being handed bad Attributes by XMLReader. The document being parsed is UTF-8 with multi-byte characters inside XML attributes. What appears to happen is that these attributes are…
mckamey
  • 17,359
  • 16
  • 83
  • 116
5
votes
3 answers

XmlReader behaves different with line breaks

If the data is on a single line the index=int.Parse(logDataReader.ReadElementContentAsString()); and value=double.Parse(logDataReader.ReadElementContentAsString(), cause the cursor to move forward. If I take those calls out I see it loop 6 times…
paparazzo
  • 44,497
  • 23
  • 105
  • 176
5
votes
1 answer

How to ignore unknown namespaces with C# XmlReader?

I'm trying to read string XML snippets from input using the XmlReader, manipulate the XDocument and output the result as a string. In case there is a reference to unknown XML namespace, I just want this reference to be kept, not modified in any…
Martin Suchan
  • 10,600
  • 3
  • 36
  • 66
5
votes
2 answers

Prevent XmlReader from expanding XML entities

Is there a way to prevent .NET's XmlReader class from expanding XML entities into their value when reading the content? For instance, suppose the following XML is used as input:
Gabriel S.
  • 1,347
  • 11
  • 31
5
votes
1 answer

PHP XMLReader read , edit Node , write XMLWriter

I have an XML file which is very very large (millions of records). Due to speed and memory constraints I plan to use XMLReader/XMLWriter. I need to read the file, getting one record, change its attribute, and finally save XML again. For testing I…
Rami.Q
  • 2,486
  • 2
  • 19
  • 30
5
votes
1 answer

XmlException while parsing xml with encoding specified as "utf-16"

I have an issue with parsing XML which has utf-16 encoding but it works perfectly fine with utf-8. Can any help me out on this issue?. I get the following error : System.Web.HttpUnhandledException' was thrown. System.Xml.XmlException: There is…
user845405
  • 1,461
  • 5
  • 23
  • 43
5
votes
2 answers

Validating a large XML file ~400MB in PHP

I have a large XML file (around 400MB) that I need to ensure is well-formed before I start processing it. First thing I tried was something similar to below, which is great as I can find out if XML is not well formed and which parts of XML are…
Carlton
  • 5,533
  • 4
  • 54
  • 73
5
votes
3 answers

LINQ to XML vs. XmlReader

In my Silverlight application I'm using mostly XmlReader but I'm playing with idea to replace XmlReader implementation with LINQ to XML. What are pros and cons between LINQ to XML and XmlReader in Silverlight?
Vadim
  • 21,044
  • 18
  • 65
  • 101
5
votes
2 answers

Abusing XmlReader ReadSubtree()

I need to parse a xml file which is practically an image of a really big tree structure, so I'm using the XmlReader class to populate the tree 'on the fly'. Each node is passed just the xml chunk it expects from its parent via the ReadSubtree()…
Trap
  • 12,050
  • 15
  • 55
  • 67
4
votes
1 answer

Why would my XmlReader return an empty string?

I need to get the full Xml string from an XmlReader (long story). In this sample code though, the final variable, theXmlString, remains empty. Why does it not get assigned the Xml string? string xmlConfig = @"
willem
  • 25,977
  • 22
  • 75
  • 115