07-06-2007, 03:29 PM
[eluser]pmonty[/eluser]
I am generating a specific xml stream with a helper function I wrote to feed an html page. The xml being returned by CI includes some whitespace at the beginning of the stream which is fouling up the use of the xml stream by my javascript grid object. If I write the string to a file and load the xml file, it works fine, but when I try to load from the stream, it coughs and gives me an error. Email support from the grid code provider (dxhtmlgrid) told me to be sure there is no whitespace before the <?xml header in the stream. The generated file does not have it and loads fine but when I call the makexml script directly, I can see the whitespace at the top of the stream. It seems to me that somewhere in the CI output stream this is being generated and I can't seem to get rid of it. Any ideas?
I have even tried echoing a trimmed string but the white spaces are still there. Here is what I have tried.
Paul
I am generating a specific xml stream with a helper function I wrote to feed an html page. The xml being returned by CI includes some whitespace at the beginning of the stream which is fouling up the use of the xml stream by my javascript grid object. If I write the string to a file and load the xml file, it works fine, but when I try to load from the stream, it coughs and gives me an error. Email support from the grid code provider (dxhtmlgrid) told me to be sure there is no whitespace before the <?xml header in the stream. The generated file does not have it and loads fine but when I call the makexml script directly, I can see the whitespace at the top of the stream. It seems to me that somewhere in the CI output stream this is being generated and I can't seem to get rid of it. Any ideas?
I have even tried echoing a trimmed string but the white spaces are still there. Here is what I have tried.
Code:
// make the xmlstring from the query results using our home grown xmlmaker
$lcxmlstr = ltrim(xmlmakefile($query2->result_array(),$fldlist));
// write the string to a file to see if has spaces before the <?xml characters
$fh = fopen("testxml2.xml","wt");
fwrite($fh,$lcxmlstr);
fclose($fh); // results in no whitespace at the top of the file
// echo the string to a stream with everything before the <?xml markup cut off
echo strstr($lcxmlstr,"<?xml"); //results in stream still includes whitespace
Paul