• I’m getting an error message when i try to view my rss files and this is causing some webblog bots to not understand my site. Here’s the error message:
    XML Parsing Error: xml processing instruction not at start of external entity
    Location: http://chenu.uni.cc/wp-rss2.php
    Line Number 1, Column 2: <?xml version=”1.0″ encoding=”utf-8″?>
    -^
    This come in the news and comments rss files.

Viewing 15 replies - 1 through 15 (of 39 total)
  • Thread Starter chenu

    (@chenu)

    Can anyone please help me?

    I have the same parse error with my WP: it’s caused by the permalink structure. When I customized my permalinks (I can’t use .htaccess with my hosting) for the first time, I see that RSS links point to /feed/RSS and /comments/feed/RSS which didn’t exist… so I’ve restored the default structure of permalinks, but I received that error! The “^_” symbol is the same needed by the .htaccess file to change the URL for printing the RSS feed… but I do not know how to restore the default config (that is the way to solve the problem: before editing permalinks everything ran well)…

    The error results when you have any whitespace before your XML declaration tag. You have to eliminate any areas that might be generating whitespace before the XML declaration tag is outputted.
    -brendon
    endofyourself aat yahooooo dotcom

    Thread Starter chenu

    (@chenu)

    i don’t understand what to do. I tried removing some spaces but where do you remove them.

    Thread Starter chenu

    (@chenu)

    here is my rss2.php code
    <?php
    if (!isset($feed)) {
    $blog = 1;
    $doing_rss = 1;
    require('wp-blog-header.php');
    }
    $more = 1;
    $charset = get_settings('blog_charset');
    if (!$charset) $charset = 'UTF-8';
    header('Content-type: text/xml', true);
    ?>
    <?php echo '<?xml version="1.0" encoding="' . $charset . '"?'.'>'; ?>
    <!-- generator="wordpress/<?php echo $wp_version ?>" -->
    <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
    <channel>
    <title><?php bloginfo_rss('name') ?></title>
    <link><?php bloginfo_rss('url') ?></link>
    <description><?php bloginfo_rss("description") ?></description>
    <copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate()); ?></copyright>
    <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), 0); ?></pubDate>
    <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
    <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
    <item>
    <title><?php the_title_rss() ?></title>
    <link><?php permalink_single_rss() ?></link>
    <comments><?php comments_link(); ?></comments>
    <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', $post->post_date_gmt, 0); ?></pubDate>
    <?php the_category_rss() ?>
    <guid><?php the_permalink($id); ?></guid>
    <?php if (get_settings('rss_use_excerpt')) : ?>
    <description><?php the_excerpt_rss(get_settings('rss_excerpt_length'), 2) ?></description>
    <?php else : ?>
    <description><?php the_excerpt_rss(get_settings('rss_excerpt_length'), 2) ?></description>
    <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
    <?php endif; ?>
    <wfw:commentRSS><?php echo comments_rss(); ?></wfw:commentRSS>
    </item>
    <?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
    </channel>
    </rss>

    I am having the same problem. I have not been able to figure out the file that is causing the extra ‘ ‘ in the front of the <?xml line.
    I am new to php, am I to assume that any files that have all code in them must end with ?> and not ?>(then a new line)?
    Any help pointing to what files I need to look at would be appreciated. I would like to get this working.
    Thank you.
    Perogi.
    http://www.perogi.org

    The extra space often comes from a plugin or WordPress file that you edited.

    allusion
    Thank you for your reply. So you are saying that you should always make sure that php files end with ?> (where appropriate) and never with a newline?
    Which include files are used for the rss feed?
    Thanks again!
    Perogi.

    It would be helpful if someone who uses php could answer this question for me. I am a Java coder, not php and don’t know of all of the intracacies of the language.
    Thanks in advance.
    Perogi.

    I figured it out.
    One of the plugins was jacked up. Anyone else with this problem may want to check them first (since it’s easy to refresh your wp-rss2.php file).
    Perogi.

    I would like to confirm that with the same problem (i.e. “XML parsing error) I have fixed the bug removing the \newline character at the bottom of one .php file
    Paolo

    Yes,
    ALL whitespace from any includes or before or after any PHP delimiter tags must be eliminated as well.
    Brendon
    endofyourself AAATTT yahoooo dotcom

    Hi – I am having the same problem and am struggling a bit here – looking for places where I may have white space in one blog, but not in others. So far no luck.
    In which files have you been finding the errors? Perogi – you found it in a plugin – which plugin?
    thanks

    Yeah, what plugin dude?

    XML Parsing Error: xml processing instruction not at start of external entity
    Location: http://site/wp/wp-rss2.php
    Line Number 1, Column 3: <?xml version=”1.0″ encoding=”utf-8″?>
    –^
    What is with this?
    XML Parsing Error: xml processing instruction not at start of external entity
    Location: http://site/wp/wp-commentsrss2.php
    Line Number 1, Column 2: <?xml version=”1.0″ encoding=”utf-8″?><!– generator=”wordpress/1.2″ –>
    -^

Viewing 15 replies - 1 through 15 (of 39 total)
  • The topic ‘XML Parsing Error: xml processing instruction not’ is closed to new replies.