I dont think there is an error in the config file, since that is included in all the other pages on the site and they run fine
Main Topics
Browse All TopicsHi,
I am trying to create a feed to submit to Google news. The code is below. What I get is an error message, where the PHP code starts to parse the data base information.
The character '>' was expected.
Line: 13 Character: 41
Any help in getting this working is appreciated.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
When the page is published as a .php file, all that shows in the browser is the line with the date and time, and the keywords.
Looking in the source code, all the other information is there, just not visible in the browser.
When saved as a .xml file, it returns this error:
Whitespace is not allowed at this location.
Line: 1 Character: 3
<? require("config.php"); ?>
You can't save it as an XML file because it has PHP code in it. In order for the server to process that code, it has to have the extension of php...That being said, I highly recommend that you read this article that explains how to create the XML code you want with PHP:
http://articles.techrepubl
Looking at this code:
<? require("config.php"); ?>
<urlset xmlns="http://www.sitemaps
xmlns:news="http://www.goo
I think the effect of what you have there is to produce a line of whitespace at the top of your script. You probably want to eliminate that. Also, I've done a lot of RSS and I've never seen a urlset tag done that way before. You might want to use something more like the code snippet.
Finally, I think hibridassassin is steering you in the right direction by suggesting that the PHP script needs to create the XML, and that the output of the script must contain only XML. You may find it's best to let the PHP script just generate the XML and use some other mechanism to get the XML to Google. Or you may need to have your server parse files named like .xml through the PHP processor.
Best regards, ~Ray
hibridassassin:
This is what is being returned in the page as published from the baove code.
The character '>' was expected.
Line: 13 Character: 34
I am not sure specifically what is in the information being pulled from the data base, but that can not be changed, since it is part of the content.
Ray_Paseur:
The set tags are according to Google for submitting a news feed.
The PHP script should output the RSS feed.
Well, if Google wants it that way, then try it that way.
In order to get a handle on the message about The character '>' was expected. Line: 13 Character: 34, it would be helpful if you could post the output of the script so we can see what is being generated on line 13. You can plug that into the code snippet.
Thanks, ~Ray
All that shows in the web page is the error message.
This is what is outputted in the source code:
<urlset xmlns="http://www.sitemaps
xmlns:news="http://www.goo
<rss version="2.0">
<channel>
<title>My Site</title>
<item>
<loc><http://www.bigapplesocc
<title> TAKING OVER THE CREW Warzycha gets nod in Columbus</title></font><br />
<news:publication_date>2008-
<news:keywords>Sports, Major League Soccer, Columbus Crew</news:keywords><br />
<br /><br />
<item>
<loc><http://www.bigapplesocc
<title> HAPPY CHANUKAH To the Jewish soccer community</title></font><br />
<news:publication_date>2008-
<news:keywords>Sports, BigAppleSoccer.com</news:ke
<br /><br />
<item>
<loc><http://www.bigapplesocc
<title> GROWTH DURING TURBULENCE RSL adds jobs during trying economic times; Dynamo and Real increase sponsors</title></font><br />
<news:publication_date>2008-
<news:keywords>Sports, Real Salt Lake, Houston Dynamo</news:keywords><br />
<br /><br />
<item>
<loc><http://www.bigapplesocc
<title> SOMETIMES LESS IS MORE Unlike other sports leagues, MLS hasn't made any league office cutbacks</title></font><br />
<news:publication_date>2008-
<news:keywords>Sports, Major League Soccer, Don Garber</news:keywords><br />
<br /><br />
<item>
Thanks, I think the culprit is this line:
<?php echo" <loc><http://www.mysite.com/a
It is line 20 in hibridassassin's last post.
Could you try changing it to something like the code snippet? I think the extra < and > around the URL are causing the issue.
Regarding this thing on line 150:
</news:news>\n";
That looks like spurious junk. I would suggest you just cut it out of the script - it's an ending tag with no opening tag.
But that raises an important question, namely, where are the </item> tags that are required to close each <item> declaration?
If you would, please post the PHP script that you are using to generate the XML file, and I'll see if there is a quick fix.
Best regards, ~Ray
Below is the entire code as it is now.
Also, here is the information from Google in what they require in a news feed.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.c
<url>
<loc>http://example.com/arti
<news:news>
<news:publication_date> 2006-08-14T03:30:00Z </news:publication_date>
<news:keywords>Business, Mergers, Acquisitions</news:keywords
</news:news>
</url>
</urlset>
I ran it as above, and now i am geting this:
Parse error: parse error, unexpected T_STRING in /usr/home/sites/www.bigapp
The error seems to be in parsing the XML in line 2.
It's not putting out the XML.
Here's a link to the page, so you can see what is happening
http://www.bigapplesoccer.
I really appreciate the help with this.
Earlier, you posted this:
Also, here is the information from Google in what they require in a news feed.
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.c
<url>
<loc>http://example.com/arti
<news:news>
<news:publication_date> 2006-08-14T03:30:00Z </news:publication_date>
<news:keywords>Business, Mergers, Acquisitions</news:keywords
</news:news>
</url>
</urlset>
And that appears to be what the script is producing. Can you give me the link to the Google page that describes the format? Maybe I can find something if I read Google's instructions.
Maybe I am missing something. When I look at the page, it is not showing the formating, however it does in the source code.
Here is the Google help page
http://www.google.com/supp
The Google help page describes the Google News sitemap, a a file that allows you to have more control over the content you submit to Google News. It also helps speed up the discovery of your pages, an important first step in the article crawling and indexing processes.
This is not an RSS file, and the format of the information we are producing appears to be correct and in consonance with the instructions.
Have you tried submitting this to Google?
I am posting a new script here - it looks like you have somehow gotten slashes into your data base, possibly through the collision between magic_quotes and addslashes. This change will take them out of the title tags. However you will need to read the Google man pages carefully and determine whether the title tags are appropriate in the Google News sitemap. I can't make that decision for you.
Best of luck, ~Ray
Business Accounts
Answer for Membership
by: hibridassassinPosted on 2008-12-15 at 16:38:25ID: 23179789
I looked at the code and other than me recommending that you don't use short tags, it looks properly syntaxed. Is the error on your config file?