Subject: Re: XML Parsing Error: junk after document element

From: Jakub Narebski <[email-masked]>
Date: Thu, 11 Feb 2010 03:01:36 -0800 (PST)

Siju George <[email-masked]> writes:

> Hi,
> 
> I get this error when I take gitweb in a browser.
> 
> XML Parsing Error: junk after document element
> Location: http://172.16.3.27/cgi-bin/gitweb.cgi
> Line Number 28, Column 8:</html><!DOCTYPE HTML PUBLIC "-//IETF//DTD
> HTML 2.0//EN">
> -------^
> 
> How can I solve it?

Which version of gitweb?[1]  Which version of git?[2]  What web server?
Which version of CGI.pm is used by web server?[3]

The included fragment after closing '</html>' tag doesn't look like
something coming from gitweb, as gitweb uses XHTML 1.0 DTD since it's
first version.

Try to view source, or use different web browser that doesn't do
strict XML validation to find the source of this error.

If everything else fals, you can always edit gitweb.cgi to comment out
content-type negotiation, to always serve as text/html mimetype -
which should torn off XML validation, as below:

	my $content_type;
	# require explicit support from the UA if we are to send the page as
	# 'application/xhtml+xml', otherwise send it as plain old 'text/html'.
	# we have to do this because MSIE sometimes globs '*/*', pretending to
	# support xhtml+xml but choking when it gets what it asked for.
	# Disable content-type negotiation when caching (use mimetype good for all).
	#if (defined $cgi->http('HTTP_ACCEPT') &&
	#    $cgi->http('HTTP_ACCEPT') =~ m/(,|;|\s|^)application\/xhtml\+xml(,|;|\s|$)/ &&
	#    $cgi->Accept('application/xhtml+xml') != 0) {
	#	$content_type = 'application/xhtml+xml';
	#} else {
		$content_type = 'text/html';
	#}

The commands below are _examples_ only:
[1] grep -F 'our $version' /var/www/cgi-bin/gitweb.cgi
[2] git --version
[3] perl -MCGI -le 'print $CGI::VERSION'
-- 
Jakub Narebski
Poland
ShadeHawk on #git