I'm using PHP arrays to translate XML into XHTML. But when I view the source of the outputted page from the browser, I find extra space. It has put a carriage return followed by nine single spaces after each piece of data. This is because the spaces are there in the XML file (generated from XML Notepad).
My code comes out like this:
---------< a href='Ag040603.doc
---------' title='Word'>(Agenda)< /a>< /td>
(Where "-" represents a space.) Luckily it still works.
I looked at controlling whitespace but that is only between tags. I thought my routine merely took the data between each tag and output the right HTML when a certain tag is found. Now it seems to be outputting spaces from the original file as well.
I don't want to remove all carriage returns as they can be useful in outputting clear HTML code flow. But I want to remove them from occuring after each piece of data is output (because as you can see above it is breaking up lines of HTML).
Is the only way to scan the XML first and remove spaces and returns?
It's pretty basic because I am a beginner. There are many more fields in there I have left out for this example. Note that if you open the file in Notepad, there are returns and 9 spaces before the key elements.