Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
indr is on a distinguished road
 
Posts: 4
Join Date: Nov 2011
Question XML Error!! - 11-24-2011, 11:21 AM

I tried the following code to generate an XML file using php!!
Code:
<?php
$doc= new DOMDocument("1.0");
$node= $doc->createElement('markers');
$parnode= $doc->appendChild($node);
$newnode= $doc->createElement('marker');
$parnode->appendChild($newnode);
header('Content-type:text/xml');
echo $doc->saveXML();
?>
The above code is working fine in my local host XAMPP server. But when I tried it on webhost it is giving me the following error:
"This page contains the following errors:
error on line 5 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error."
Can you please tell me Whats wrong with this code?? or why its working on local host but not in webhost??
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
ShocK's Avatar
Senior Member
ShocK is on a distinguished road
 
Posts: 4,106
Join Date: Jul 2011
Location: UK
Default 11-24-2011, 12:57 PM

This is what I get using it
Attached Images
File Type: jpg noerror.JPG (13.5 KB, 7 views)
Reply With Quote
(#3 (permalink))
Old
Junior Member
indr is on a distinguished road
 
Posts: 4
Join Date: Nov 2011
Default 11-27-2011, 03:29 PM

Hi that is the output i should be getting but without the <script/> tag.
but instead i am getting the following error:
Quote:
XML Parsing Error: junk after document element
Location: http://amritha.hostzi.com/coordinatesFile/sample.php
Line Number 5, Column 1:<script type="text/javascript" src="http://analytics.hosting24.com/count.php"></script>
^
Quote:
<parsererror>
XML Parsing Error: junk after document element Location: http://amritha.hostzi.com/coordinatesFile/sample.php Line Number 5, Column 1:
<sourcetext>&lt;script type="text/javascript" src="http://analytics.hosting24.com/count.php"&gt;&lt;/script&gt; ^</sourcetext>
</parsererror>
Reply With Quote
(#4 (permalink))
Old
ShocK's Avatar
Senior Member
ShocK is on a distinguished road
 
Posts: 4,106
Join Date: Jul 2011
Location: UK
Default 11-27-2011, 03:39 PM

Ahh, try disabling analytics - http://members.000webhost.com/analytics.php
Reply With Quote
(#5 (permalink))
Old
Junior Member
indr is on a distinguished road
 
Posts: 4
Join Date: Nov 2011
Default 11-27-2011, 05:10 PM

aahhhhhhhhh thanks a lot!!thank you very much!!
Reply With Quote
(#6 (permalink))
Old
Gitlez's Avatar
Member
Gitlez is on a distinguished road
 
Posts: 76
Join Date: Nov 2011
Location: Canada
Default 11-30-2011, 09:48 PM

Or you could turn off the analytics on certain pages, such as XML files, with htaccess

Code:
<FilesMatch "\.(js|css|txt|xml)$">
php_value auto_append_file none
php_value auto_prepend_file none
</FilesMatch>
Just an option for those looking for it.


Cheers,
Gitlez
Reply With Quote
(#7 (permalink))
Old
Junior Member
indr is on a distinguished road
 
Posts: 4
Join Date: Nov 2011
Default 12-01-2011, 08:49 AM

thank you again
Reply With Quote
Reply

Tags
php, xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com