PDA

View Full Version : New Lines in XML files



adityagaddam
July 12th, 2003, 01:00 PM
oki.. I have to have a block of text to be saved in an XML file. But when I have newlines in the XML file and I try to get the XML file to parse in PHP, I only get the last line (i.e. the text after the last new line)

How can I get around this..

my XML file looks like the following



<HOME>
<MAINTEXT>First Line
Another Line</MAINTEXT>
<NEWS>
</NEWS>
</HOME>


but php just reads "Another Line"

Please help
-Aditya

adityagaddam
July 12th, 2003, 01:24 PM
well.. u admin guys can close this topic if u want.. I figured the thing out. But for those who may need the same info. All you need to do is when writing the XML file, replace all instances of "\r\n" with some fake newline character like "-nl-". Then when readin it you can replace all instances of "-nl-" with "\n". And it works!

-Aditya
:thumb: