Professional Web Applications Themes

#39909 [Opn->Bgs]: XML Parsing Error: xml declaration not at start of external entity - PHP Bugs

ID: 39909 Updated by: [email]tony2001php.net[/email] Reported By: timcbest at gmail dot com -Status: Open +Status: Bogus Bug Type: DOM XML related Operating System: FreeBSD PHP Version: 5.2.0 New Comment: Sorry, but your problem does not imply a bug in PHP itself. For a list of more appropriate places to ask for help using PHP, please visit [url]http://www.php.net/support.php[/url] as this bug system is not the appropriate forum for asking support questions. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation ...

  1. #1

    Default #39909 [Opn->Bgs]: XML Parsing Error: xml declaration not at start of external entity

    ID: 39909
    Updated by: [email]tony2001php.net[/email]
    Reported By: timcbest at gmail dot com
    -Status: Open
    +Status: Bogus
    Bug Type: DOM XML related
    Operating System: FreeBSD
    PHP Version: 5.2.0
    New Comment:

    Sorry, but your problem does not imply a bug in PHP itself. For a
    list of more appropriate places to ask for help using PHP, please
    visit [url]http://www.php.net/support.php[/url] as this bug system is not the
    appropriate forum for asking support questions. Due to the volume
    of reports we can not explain in detail here why your report is not
    a bug. The support channels will be able to provide an explanation
    for you.

    Thank you for your interest in PHP.




    Previous Comments:
    ------------------------------------------------------------------------

    [2006-12-20 19:27:13] timcbest at gmail dot com

    Description:
    ------------
    When generating XML from DOMDoent I get this error:

    Error:
    XML Parsing Error: xml declaration not at start of external
    entity
    Location: [url]http://test.mysite.com/getcounty.php?state=MS[/url]
    Line Number 1, Column 2: <?xml version="1.0" encoding="UTF-8"?
    >
    -^






    Reproduce code:
    ---------------
    function formulateResponse($info){

    $dom = new DOMDoent('1.0', 'UTF-8');
    $dom->formatOutput = true;
    $root = $dom->createElement('response');
    $root = $dom->appendChild($root);

    foreach($info as $index => $county_array){
    $county = $dom->createElement('county');
    $county = $root->appendChild($county);

    $name = $dom->createTextNode($county_array['county']);
    $name = $county->appendChild($name);

    }

    header('Content-Type: text/xml');
    echo $dom->saveXML();

    }



    Expected result:
    ----------------
    I expect the browser to be able to p the XML below.
    This is the XML generated by the above function. Whether I
    call it from an Ajax call or directly in the browser
    (Firefox 1.5.0.8 or Safari 2.0.4) the error is generated as
    specified in the description box above.

    <?xml version="1.0" encoding="UTF-8"?>
    <response>
    <county>Adams</county>
    <county>Alcorn</county>
    <county>Amite</county>
    <county>Attala</county>
    <county>Benton</county>
    <county>Bolivar</county>
    <county>Calhoun</county>
    <county>Carroll</county>
    <county>Chickasaw</county>
    <county>Choctaw</county>
    <county>Claiborne</county>
    <county>Clarke</county>
    <county>Clay</county>
    <county>Coahoma</county>
    <county>Copiah</county>
    <county>Covington</county>
    <county>De Soto</county>
    <county>Forrest</county>
    <county>Franklin</county>
    <county>George</county>
    <county>Greene</county>
    <county>Grenada</county>
    <county>Han</county>
    <county>Harrison</county>
    <county>Hinds</county>
    <county>Holmes</county>
    <county>Humphreys</county>
    <county>Issaquena</county>
    <county>Itawamba</county>
    <county>Jackson</county>
    <county>Jasper</county>
    <county>Jefferson</county>
    <county>Jefferson Davis</county>
    <county>Jones</county>
    <county>Kemper</county>
    <county>Lafayette</county>
    <county>Lamar</county>
    <county>Lauderdale</county>
    <county>Lawrence</county>
    <county>Leake</county>
    <county>Lee</county>
    <county>Leflore</county>
    <county>Lincoln</county>
    <county>Lowndes</county>
    <county>Madison</county>
    <county>Marion</county>
    <county>Marshall</county>
    <county>Monroe</county>
    <county>Montgomery</county>
    <county>Neshoba</county>
    <county>Newton</county>
    <county>Noxubee</county>
    <county>Oktibbeha</county>
    <county>Panola</county>
    <county>Pearl River</county>
    <county>Perry</county>
    <county>Pike</county>
    <county>Pontotoc</county>
    <county>Prentiss</county>
    <county>Quitman</county>
    <county>Rankin</county>
    <county>Scott</county>
    <county>Sharkey</county>
    <county>Simpson</county>
    <county>Smith</county>
    <county>Stone</county>
    <county>Sunflower</county>
    <county>Tallahatchie</county>
    <county>Tate</county>
    <county>Tippah</county>
    <county>Tishomingo</county>
    <county>Tunica</county>
    <county>Union</county>
    <county>Walthall</county>
    <county>Warren</county>
    <county>Washington</county>
    <county>Wayne</county>
    <county>Webster</county>
    <county>Wilkinson</county>
    <county>Winston</county>
    <county>Yalobusha</county>
    <county>Yazoo</county>
    <county>Statewide</county>
    </response>

    Actual result:
    --------------
    Error:
    XML Parsing Error: xml declaration not at start of external
    entity
    Location: [url]http://test.mysite.com/getcounty.php?state=MS[/url]
    Line Number 1, Column 2: <?xml version="1.0" encoding="UTF-8"?
    >
    -^


    ------------------------------------------------------------------------


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39909&edit=1[/url]
    tony2001@php.net Guest

  2. #2

    Thumbs up Re: #39909 [Opn->Bgs]: XML Parsing Error: xml declaration not at start of external en

    The blank lines in the feed is creating issues. But how that blank lines got introduced into the RSS XML Feed? There are many reasons. If your client is using PHP based application to generate the feed then this could help you..
    . Read the globinch.com article on this. That really helped me
    http://www.globinch.com/2010/09/15/wordpress-rss-feed-xml-parsing-error/
    Unregistered Guest

Similar Threads

  1. Replies: 0
    Last Post: December 20th, 07:27 PM
  2. Http error 413 Request entity too large
    By Darie Florin in forum ASP.NET Web Services
    Replies: 12
    Last Post: October 13th, 01:01 PM
  3. Http error 413->request entity too large
    By Darie Florin in forum ASP.NET Security
    Replies: 1
    Last Post: June 29th, 07:49 AM
  4. [BUG] REXML 2.7.1 External Entity Parsing
    By Paul Duncan in forum Ruby
    Replies: 1
    Last Post: September 5th, 01:54 PM
  5. Type Declaration Error
    By Austin Bike in forum Microsoft Access
    Replies: 2
    Last Post: July 16th, 08:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139