View Full Version : XML junk from network?
benjoya
09-02-2007, 05:20 PM
i'm populating a bunch of text fields from an XML doc using URLLoader. it works fine with a local XML file, but when i give it a URL to the same file on the server, the XML comes back with a couple of junk characters ("?ø"--um, that first junk character is not a question mark but a weird, half-shaded square) before the first XML tag, throwing the whole enterprise in the digital toilet. FWIW, it's a windows server and i develop on a mac. any ideas? thanks, dave.
panel
09-03-2007, 09:51 AM
It's definitly encoding problem
dis you added proper tag to xml? sth like this
<?xml version="1.0" encoding="utf-8"?>
benjoya
09-03-2007, 08:23 PM
Yes, the xml doc starts with that line. i even downloaded it from the server, then replaced the one in my local folder -- no problem.
panel
09-03-2007, 09:49 PM
can youpost your source code?
benjoya
09-03-2007, 10:10 PM
here. thanks again, dave
import flash.net.URLRequest;
import flash.net.URLLoader;
import flash.events.*;
var pageXMLLoader:URLLoader = new URLLoader();
pageXMLLoader.addEventListener(Event.COMPLETE, loadXMLHandler);
pageXMLLoader.load(new URLRequest("http://www.thesaudiagenda.com/duh/com/duh_text.xml"));
// [when i replace the above URL with just "com/duh_text.xml"(local reference) it works fine]
function loadXMLHandler(myEvent):void {
var tempXML:XML = new XML(pageXMLLoader.data);
trace(tempXML);
}
panel
09-04-2007, 08:05 AM
In my case it wouldn't work either, even if I downloaded it locally. There was 3 unneded characters at the beginning of file. After removing them everything worked fine. See attached file
benjoya
09-04-2007, 07:37 PM
thanks. weird it looks just like my file, but when i up load it, i'm cool (edited in dreamweaver, FWIW) now i've got sandbox problems, but that can wait for another thread. thanks a lot, dave
panel
09-04-2007, 10:05 PM
I used notepad2 (http://www.flos-freeware.ch/notepad2.html) to edit it.
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.