03-13-2003, 08:18 PM
Hello, I am working on a rather elaborate XML parsing project using expat and I was looking over my output to verify it and I realized that the character after every > is cut off in the output. It doen't really matter when the next character is an end-of-line, but there are some times that I get spaces between words and even characters in words being cut out. Does anyone have any idea as to what might be doing this. I have source, but it is rather large. If you have any ideas as to what might be doing this without seeing the code, your help would be greatly appreciated. Thanks a lot.
03-13-2003, 09:08 PM
I remember this (if it's what I think it is) - it nearly drove me insane :eek: Basically - it's a behavior (or bug; don't know which) in the API whereby it splits cdata around entities (and possibly other special characters), and calls a new instance of the parser for each chunk. If you don't allow for this, you lose all but the first or last part of the data.
You can allow for it with string concetenation; something like
$var .= $data;
Check out http://www.php.net/manual/en/ref.xml.php for more (the notes at the bottom are particularly helpful; where I found this answer)
03-14-2003, 07:46 PM
I solved it, I was doing some substinging wrong in the read loop. Sorry to havve bothered everyone.