[Expat-bugs] Junk after document element

Karl Waclawek karl at waclawek.net
Thu Jul 13 19:38:51 CEST 2006


Myron Turner wrote:
> I'm not a subscriber to the expat bugs list, but I've been developing an 
> XML Pull Parser for PHP, using PHP 5 and  expat 1.95.8.  When I run 
> tests on earlier versions of expat, for the same XML I will get the 
> "junk after document element" error.  I see from google that the xml 
> mailing lists are full of questions concerning this error.  I've looked 
> briefly at the expat code and see that tokens are passed to an error 
> checking function which defaults to a return value of 
> XML_ERROR_JUNK_AFTER_DOC_ELEMENT, which could explain why this error 
> appears so often.
>
> I've looked through the bug reports and checked the subject headers to 
> the expat bugs mailing list archives , but I can't find any reference to 
> this problem.  Has this been noticed and silently fixed?  If in fact 
> this is a bug in earlier versions of expat I'd like to make an 
> accommodation in my own code, in so far as I'm able to determine which 
> version of expat or PHP is being used.
>
>   
There is no know bug that I am aware of.

XML_ERROR_JUNK_AFTER_DOC_ELEMENT simply means that the buffer passed to
the parser contained extra characters after the end of the document.
It is a common error not to tell the parser exactly where the last buffer ends.
Maybe you should review your parser loop or post it here.

Karl




More information about the Expat-bugs mailing list