[thelist] placing the pointer in a text file using PHP..

Kelly Hallman khallman at wrack.org
Tue Dec 31 11:55:00 CST 2002

On Mon, 30 Dec 2002, Tom Dell'Aringa wrote:
> Carl that works great! I have one other problem, maybe you or someone
> knows why.. about 170 lines into 4000+ lines of the XML code, I get this
> error: XML error: no element found at line 169
> There isn't any abnormality in the XML at that point that I can see.
> You can view the xml file at www.silverheaven.com/reg/catalog.xml.

There's no abnormality in the XML.  The problem is when you are passing
the file by chunks to the parser, apparently it is hitting on some
boundary which is causing this problem.  If you change the fread()
length from 4096 to 8192 (or an arbitrary value) you will notice that the
error occurs on a different line of the input.

I'm curious why no one commented on my two lines of code yesterday, they
worked flawlessly and I was able to shave off almost half the code.

Perhaps I scared people off by saying it wasn't terribly efficient?
Given that you're only parsing about 100k of XML, I am not sure it would
have much impact on the performance.  I thought I'd try some benchmarking,
but I couldn't get your code to parse the XML fully.

Kelly Hallman

More information about the thelist mailing list