NSXMLParserErrorDomain error 5 (tried everything, no luck)

  1. Hello all,

    I am getting the NSXMLParserErrorDomain error 5 when attempting to set up wordpress for iphone with my blog. I have tried pretty much every single tip or trick known to man on this forum as well as on Google to no avail. Here is what I know so far:

    I reset my blog to the default template and deactivated all plugins.
    XMLRPC is enabled in the WordPress settings
    The XMLRPC rsd link returns valid (
    The XMLRPC itself returns a valid xml page.

    Tried this, but I am not using mod_security, so it just makes my site give an Internal Server/500 error:
    <Files xmlrpc.php>
    SecFilterInheritance Off

    Also, I made sure that the EditURI link is in between the <head> tags and it is...

    I'm about ready to tear my hair out. Is there anything else I'm missing?

    I'm running:
    WordPress version 2.8.6
    WordPress for iPhone version 2.1

  2. Hi,

    As you'll see in the sticky post at the top of the forum, the #5 error is described as:

    NSXMLParserPrematureDocumentEndError = 5,

    This implies that somewhere in the XML being returned from your xmlrpc endpoint there is a premature end of the document.

    If you have a Mac environment, you can use the free tool HTTP Client to send a complete XMLRPC POST to your xmlrpc endpoint. The most likely problem is that one of the requests is returning malformed XML.

    I pinged your xmlrpc endpoint with HTTP Client and that response seems to look OK to a validator.

    That implies that other xmlrpc requests are returning malformed XML - and that the part that is malformed is, as the error says, a premature end of the document.

    If you are using default template and de-activiated all plugins this shouldn't happen. It may suggest a corruption (or extra line etc) in one of your files. If you can, I would suggest re-downloading WP and starting over...

    If you test with HTTP Client - when you get the response, you can copy and paste it into an XML validator online and see where the error is occuring. Then you will need to isolate the php on your site that is causing that specific malformed XML.

    I suggest sending the following requests to try and isolate your problem.


    If you have a Mac and are willing to try, let me know and I'll send you some http client files with the appropriate XMLRPC requests already built for you to try. (you'll need to edit username and password of course)

  3. I do have a mac, and the HTTP Client software as well. Feel free to send me the http client files and I will test them out. If you need it, my email is:



  4. I have also reinstalled WordPress completely to no avail. Any other thoughts?


  5. @aliby -- where is your site hosted ?

    Another thing to try to rule out network issues / iPhone specific issues, is to start a free blog on and see if that works with the app. if it doesn't, then we know something else is going on.

  6. raanan -- this is a self-hosted blog on a server I run and maintain.

  7. Also, I created a blog on ( and the iPhone app connected to it on the first try.

    Any other thoughts regarding my original issue of the iPhone client not connecting to my WP blog?

    Also, jb6262, when you get a chance, send me the HTTP Client files and I will check to see what the difference is between the blog and the one I personally host.



  8. *bump* -- jb6262 where are you?! :-p

    Does anyone have any further ideas on this? I have disabled all plugins and am using a default template. I have even reinstalled WordPress to see if that did anything (and of course, nope, it didnt).

  9. I was able to find another xmlrpc debugger ( that I was able to use. Entering my blog info into it, I was presented with this result:

    HTTP/1.1 200 OK
    Date: Sat, 05 Dec 2009 16:57:38 GMT
    Server: Apache
    X-Powered-By: PHP/5.2.11-pl1-gentoo
    Content-Length: 169
    Connection: close
    Content-Type: text/html
    <br />
    <b>Fatal error</b>:  Call to undefined function xml_parser_create() in <b>/var/www/</b> on line <b>165</b><br />
    HEADER: date: Sat, 05 Dec 2009 16:57:38 GMT
    HEADER: server: Apache
    HEADER: x-powered-by: PHP/5.2.11-pl1-gentoo
    HEADER: content-length: 169
    HEADER: connection: close
    HEADER: content-type: text/html
    XML error: junk after document element at line 2, column 0

    Therefore I assumed it had something to do with PHP not having XML support compiled in, which was the case. I recompiled PHP with XML support.

    Lo and behold, a restart of apache (after installing PHP with XML support) fixed the problem. I am now logged into my blog on my iPhone.

    Thanks to all for your help!

  10. aliby - sorry for slowness!

    Looks like you solved it! Well done and thanks for taking the time to post back!

  11. suburbandollar
    Feb 11, 2010, 5:54 PM

    I am getting the NSXMLParserErrorDomain error 5 error when trying to pull comments or pages. It doesn't happen when I am getting posts. I don't know what the problem is or how to check it, please help. My Website is

  12. First remove all custom code, plugins, and change to the default theme. Try adding again. If that doesn't work, let me know. These errors relate to malformed xml and can be difficult to troubleshoot. In your case, I looked it up in the sticky post at the top of this forum and found "premature document end" as the cause...

    Doubt if that rings any bells, but try those things and let me know.

  13. suburbandollar
    Mar 27, 2010, 2:58 PM

    A month later but I figured out. going to showed a memory error. I was able to go in to wp-settings.php and change the memory from 32M to 64M and now it is working. The premature end was because the blog was returning a memory error instead of XML data.


  14. Very cool - thanks for taking the time to post back about the problem. That's sure to help other users getting the same error...

  15. I had a similar issue. In my case xml-rpc.php returned the content length wrong. I'm running php on an IIS6.0 Server. I have 2 blogs on it, but it only happens on one of them. No idea why?

    But I just changed class-IXR.php and hacked it to add 2 bytes to the content length. Seems to work so far.
    Here are the details:

    Good luck!

  16. I have the same issute, but I can't seem to fix it, I have now tried a bit, but I think I need some help.
    My blogg-url is:

  17. btw: I have tried to set up a blog at, and that worked perfectly, and I could access it via my iPhone, so I think it has to be my webserver.. :/

  18. Regular text-based post adds/updates work just fine from the iphone, but I am getting the NSXMLParserErrorDomain error 5 on picture uploads.

    I've tried lots of stuff. Most recently, looking at wp-settings.php lead me to wp-includes/default-constants.php, where I bumped up the WP_MEMORY_LIMIT to 128MB with no luck. My php.ini settings are also bumped up as far as the max allowed upload file size.

    Any other advice?

  19. I'm gonna bump this thread, 'cause I really need some help. The blog is kind of unusefull to me, if I can't blog from my phone.

  20. I have the same error in two blogs with Wordpress 3.0 installed, I found that disabling some plugins can make it work. The problem is that I need those plugins enabled.

    Any ideas?

  21. I am now able to edit all my posts, but not publish new post via the iPhone. Don't understand why, but the only option I have to save a new post is to save it on the phone..

  22. l_h2o_L - what plugins did you have to disable to get it to work?

  23. moodboom: Ultimate Google Analytics, Vipers Video Quicktags, WPtouch iphone theme

  24. So,? are we stuck here? any ideas? o.O

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.