WordPress.org

Ready to get started?Download WordPress

Forums

XML-Error, OPML-Import (32 posts)

  1. KimHbel
    Member
    Posted 7 years ago #

    Since upgrading to WP 2.1 I get this Error when importing my opml-file:

    Importing...
    XML error: no element found at line 1

    Inserted 0 links into category 56. All done! Go manage those links.

    I searched in the Forum, but can't find any relating post to WP 2.1. Before upgrading to 2.1 I got the latest 2.0 - Version running and had no Problems with importing from file.

    Any hints or resolutions?

  2. MichaelH
    Member
    Posted 7 years ago #

    I was able to duplicate your problem. Unfortunately, the only thing I can offer is that I reported it as a bug.

    http://trac.wordpress.org/ticket/3712

  3. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Could we get an example of this OPML document that causes the problem?

  4. MichaelH
    Member
    Posted 7 years ago #

    Good idea! Attached to ticket at:
    http://trac.wordpress.org/ticket/3712

  5. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Huh. I took a look at WordPress 2.07's link-parse-opml.php and 2.1's version of same. This is the file that parses the OPML input file.

    Other than irrelevant spacing, they are identical. What parses in one should parse in the other, given the same PHP versions on both blogs and such...

    Trying to import your file myself, I also get:
    "XML error: no element found at line 1". This suggests a problem with the upload process, since the parsing is identical.

  6. MichaelH
    Member
    Posted 7 years ago #

    Attached a different file to that ticket Otto42. Thanks for looking at this.

    @KimHbel - if you have a file of opml links, please consider attaching that to the ticket also. Thanks.

  7. KimHbel
    Member
    Posted 7 years ago #

    I uploaded two opml-files to the ticket obove. HTH.

  8. numbbono
    Member
    Posted 7 years ago #

    I see that this ticket has not been resolved. Is there any news on this problem. I'm having the exact same problem. It worked fine in the previous version, but I get the same error mentioned above.

    i've been attempting this with an exported opml file from bloglines.com. I also tried it with an opml file from google reader, but had the same results.

    This driving me nuts.

  9. KimHbel
    Member
    Posted 7 years ago #

    The problem is still unsolved as I could say from my point of view.

    Hope lies in the next release of WP *g*... maybe it'll be fixed there.

  10. antimedia
    Member
    Posted 7 years ago #

    I am having the same problem. I've searched for solutions and read the code in wp-admin/link-parse-opml.php, scratched my head, nothing works. I can't even find this error code (invalid document end) in the php.net xml parsing error codes.

    Glad to see it's not just me.

  11. antimedia
    Member
    Posted 7 years ago #

    I just exported my Bloglines feed and tried to import it. It also fails, with the same error message.

  12. antimedia
    Member
    Posted 7 years ago #

    I compared the code in the link-parse-opml.php files from 2.0.7 and 2.1, and there's some minor changes in formatting but nothing else. I then swapped the 2.0.7 version for the current version in 2.1, and the uploads still fail with the same error. So it doesn't appear that the problem is in that file.

  13. antimedia
    Member
    Posted 7 years ago #

    It looks like this might be relevant:
    php and XHTML discussion

    It appears that valid XHTML is having problems with xml tags because they look like php tags:
    <?xml vs. <?php and php doesn't require the php. You can simply do this: <? - so xml looks like php to the web browser.

    I think this may be what is breaking the uploads.

  14. dbMe
    Member
    Posted 7 years ago #

    The import will work if you upload it to your server and use the HTTP method to then access the file. This may be because the page is not being sent/parsed as XML when the upload method is used.

  15. KimHbel
    Member
    Posted 7 years ago #

    I see, using this procedure (Uploading and importing via http) works fine but a bit "uncomfortable".

    It's a work-around till there would be a solution for the direct upload from local file. Thanx a lot, you made my day :-)

  16. bluehole
    Member
    Posted 7 years ago #

    Same problems, so I tried the suggested workaround and got this:

    *

    Importing...

    Fatal error: Cannot redeclare startelement() (previously declared in /home/bluehole/public_html/bluehole/wp/wp-content/plugins/blogger-rss-import.php:99) in /home/bluehole/public_html/bluehole/wp/wp-admin/link-parse-opml.php on line 21

    Any ideas?

  17. Nizz
    Member
    Posted 7 years ago #

    For people looking for a quick hack, the following patch did the trick for me. I am not a WP hacker, so just replaced the wp function with the php builtin.

    Index: wp-filer/link-import.php
    ===================================================================
    --- wp-filer/link-import.php    (revision 303)
    +++ wp-filer/link-import.php    (revision 304)
    @@ -97,7 +97,11 @@
                                    }
    
                     if (isset($opml_url) && $opml_url != '') {
    -                    $opml = wp_remote_fopen($opml_url);
    +                        if (substr($opml_url,0,4) == 'http') {
    +                                $opml = wp_remote_fopen($opml_url);
    +                        } else {
    +                                $opml = file_get_contents ($opml_url);
    +                        }
                         include_once('link-parse-opml.php');
    
                         $link_count = count($names);
  18. KimHbel
    Member
    Posted 7 years ago #

    thx!

    Works fine! You made my day :-)

  19. relaxedguy
    Member
    Posted 7 years ago #

    what file did you edit?

  20. KimHbel
    Member
    Posted 7 years ago #

    /wp-admin/link-import.php

  21. dbasden
    Member
    Posted 7 years ago #

    Worked for me as well. Thanks! That's a relief!

  22. mawilson
    Member
    Posted 7 years ago #

    Sorry if this is a really dumb question, but how do I apply that patch? (still getting to grips with WordPress). Mark

  23. learnerblogger
    Member
    Posted 7 years ago #

    I'd love some more explicit instructions too please!

  24. mawilson
    Member
    Posted 7 years ago #

    Anyone able to help out learnerblogger and I? Or can someone confirm if this is fixed in 2.1.3? M

  25. KimHbel
    Member
    Posted 7 years ago #

    cfm, it's fixed in the 2.1.3-Release. I've tested it out with my google-reader.opml-File.

    So I think, this case is closed.

    bye, Kim

  26. learnerblogger
    Member
    Posted 7 years ago #

    I still can't get my OPML file to import.

    I have tried an OPML created by FeedDemon and one created in Bloglines but still get the same error ...

    XML error: no element found at line 1

    And yes, I have upgraded to WP2.1.3

  27. mawilson
    Member
    Posted 7 years ago #

    @KimHbel - thanks, although I still couldn't get it to work using a local file - only via URL (I also used Google Reader)

    @learnerblogger - see above - try importing from a file in your webspace. You could also try to validate your OPML.

  28. altoyes
    Member
    Posted 7 years ago #

    nizz and others
    i have the right file , thankyou
    /wp-admin/link-import.php

    now where do i insert the below code in link-import.php?
    and do i have to delete anything?

    --- wp-filer/link-import.php    (revision 303)
    +++ wp-filer/link-import.php    (revision 304)
    @@ -97,7 +97,11 @@
                                    }
    
                     if (isset($opml_url) && $opml_url != '') {
    -                    $opml = wp_remote_fopen($opml_url);
    +                        if (substr($opml_url,0,4) == 'http') {
    +                                $opml = wp_remote_fopen($opml_url);
    +                        } else {
    +                                $opml = file_get_contents ($opml_url);
    +                        }
                         include_once('link-parse-opml.php');
    
                         $link_count = count($names);
  29. KimHbel
    Member
    Posted 7 years ago #

    Hi.

    You must open the file "link-import.php" in a text-editor of your trust and search for the line that is commented with the single "-" ($opml = wp_remote_fopen($opml_url);). This line you must comment out and put in the code marked with "+" after the line... then it would work fantastic :-)

  30. Gesu
    Member
    Posted 7 years ago #

    I had the same error with version 2.1.3. I modified the file as suggested but the only change is that now it reports that it's importing links and that they've been inserted, but when I go in the management page there's nothing.
    I updated to WP 2.2 but it's the same thing. I deleted old link-import.php and uploaded the new one, and I get the same result as with the old, modified, one: it still looks like everything goes fine but then there's nothing. I tried also the http method, uploading opml on my web space, but the result is, again, the same.
    Any idea about how this could be solved?

    Thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Topic