«« Next » « Previous
«« Next » « Previous

Link Details

Announcement

iPhone DZone: Fresh Links On Your iPhone by matt at Sat Jul 05 14:09:51 EDT 2008

Reading DZone on your iPhone just got a little bit easier. Visit http://dzone.com/iphone from your iPhone to try out our beta iPhone support. You can view stories, filter by tags, and login. We'd appreciate your feedback at feedback@dzone.com.

Apathy is the suck. Login and vote now.
Link 72407 thumbnail

By nerdyhearn
via nerdyhearn.com
Submitted: Mar 24 2008 / 18:40

A quick rundown of issues using PHP with XML.
  • 2
  • 0
  • 157
  • 18

Comments

Add your comment
User 276794 avatar

lhoguin replied ago:

0 votes Vote down Vote up Reply

Yeah well just don't put the closing tag "?>" and you'll never run on this problem again.

Also something to know is that "?>" will remove the (one) newline following it, but only one, and only if it directly follows.

User 280195 avatar

nerdyhearn replied ago:

0 votes Vote down Vote up Reply

Not putting the closing "?>" is not an option if you are including multiple files. This would render the PHP invalid and you would receive errors.

This is considering the case that you are doing something like
include_once("myfile1.php");
include_once("myfile2.php");
where each file must be valid and complete PHP. If either of those files contain an extra newline and they are included at the top of your XML-generation file then you have an invalid XML file because the first line is not the XML declaration (it is the newline from one of the included files)

Thanks for the feedback!

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (2)



Voters Against This Link (0)