xmlreader

XMLReader (in Php) and Error Handling

Quick version: Whats the standard (innovative? any?) way of catching and handling errors thrown by XMLReader due to malformed file -- specifically un-escaped characters. Prepossessing with Tidy (etc..) isn't a super appealing option, anyone know of a way to simply skip the offending node and move right along? Descriptive Version: We ...

XML Reader Performance

I've traced slugishness in my application to the bit of code that's being timed below. I knew that this would be a slow point but each request is taking an average of 1 second. The bit of xml that I'm after is always in the first tag so I don't think it's the download times that are getting me. Stopwatch stopwatch = new Stopwatch(); Xml...

How do I read the last N elements of an XML document using XmlReader?

Say I have this: <parent> <child name="1" /> <child name="2" /> ... <child name="8000001" /> <child name="8000002" /> <child name="8000003" /> <child name="8000004" /> <child name="8000005" /> </parent> How do I read the last five child elements? Due to the size of the file it is not possible to use XElement.Parse(...)...

How to create a XML with a Specific Encoding using XSLT and XMLWRITER

I am trying to apply a XSL style sheet on a source xml and write the output to a target xml file. The xsl removes the xml comments present inside the source xml. The target xml file has UTF-16 encoding in the header. But still i want the output xml to be utf-8 encoding. The code i used is XmlWriterSettings xwrSettings = ...

Reading and Writing XML as relational data - best practices

Dear friends, I'm supposed to do the fallowing: 1) read a huge (700MB ~ 10 million elements) XML file; 2) parse it preserving order; 3) create a text(one or more) file with SQL insert statements to bulk load it on the DB; 4) write the relational tuples and write them back in XML. I'm here to exchange some ideas about the best (== fast...

EXTJS XMLReader not loading data from asp.NET web page call

I have a grid panel having a datastore to load data. The Datastore has a asp.net webpagewith base params as the URL. Based on the querystring and baseparam values I am generating a XML string and returning the data as XMLStrilng by response.write. But my XMLReader is not loading the data. If I save the same string as XML file and load t...

How to write out an EntityReference (e.g. &nbsp;) to an XmlWriter, read by XmlNodeReader?

Background I'm reading and writing an XML document using reader and writer, with filtering logic in between the read and write operations to determine which parts read should be written back out (effectively it strips some tags out) ... My choice of implementation currently is the following using: XmlNodeReader, XmlWriter and XmlNodeTyp...

Can XmlReader parse out distinct entity references?

My XmlReader instance created by factory method XmlReader.Create(..) is including entity references along with surrounding text into one complete blurb of type XmlNodeType.Text (It's actually unescaping the entities into the text). For example if the XML source contains <div>this &amp; that</div> XmlReader will parse out readerInstanc...