2

Basically i have a magento collection list which i am converting to xml output.

When i try to validate the XML/page output if fails because the first line is just white space, and for XML to be valid in needs to be the start of the document.

Line 1 :
line 2 :<!DOCTYPE html>
line 3 :<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
line 4 :<head>
line 5 :<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
line 6 :<title>Seak Ecommerce Group</title>
     etc...

Further validation (HTML)(page source) of general pages etc this seems to be magento wide and also includes the last line as well.

Has anyone else seen this and/or know how this can be fixed

cheers

  • Problem may be in Class files (Model, Block, Controller, View). I suggest you to check your code changes if any. – shabbir Mar 11 '15 at 11:24
  • I don't understand, surely you just contradicted yourself in the same sentence "When i try to validate the XML/page output if fails because the first line is just white space, and for XML to be valid in needs to be the start of the document."? How can the blank line first, be needed for the XML to be valid yet a validator claims it isn't, that doesn't make any sense? – zigojacko Mar 11 '15 at 11:53
  • Because the xml is being generated via php/phtml code so its not a xml.file directly so there is something creating the white/first line space. In which case I found it, it was a empty line in a template page file. Doh! – BENN1TH Mar 11 '15 at 12:10
1

Have you looked into index.php on the document root ? I was having the same issue, and i checked disabling all modules one by one, removing BOM and everything as suggested in various forums. But before giving up, I tried opening index.php and found that this was the culprit. There were blank lines in the top of the file. I removed it and the issue was resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.