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

Tom Dell'Aringa pixelmech at yahoo.com
Mon Dec 30 19:21:00 CST 2002


--- Carl J Meyer <cjmeyer at npcc.net> wrote:
> the following code is faster and cleaner, and actually does work:
>
> $parsing = false;
> while ($data = fread($fp, 4096))
>     {
>     if($data = strstr($data, '<?xml'))
>         $parsing = true;
>     if(!$parsing) continue;
>     print $data;
>     }
>
> Give that a try,

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.

Is there some kind of limit on how much the fread() can parse or
something? That seems odd, because if I run another file I have with
the same code, only without the remove header code you wrote (since
that stuff is not in catalog.xml) it runs through the whole thing
perfectly. You can see it at www.silverheaven.com/reg/parseXML.php.

Any ideas?

You can see the full code for the page I'm working on at

http://www.silverheaven.com/reg/code.html

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the thelist mailing list