-
XML is "Malformed" when dynamically loaded
Hi guys, I'm loading xml files into Flash, using ActionScript 2.0, and using a database. I'm not writing the cgi's to output the xml, just interpreting it.
Now, most of my xml files are loading dynamically from the db just fine, except for one of them.
When I call that XML file from the db using the browser address bar, then view source, and save the xml as a static file, and then tell Flash to load the static file, Flash interprets it just fine. When I switch back to the dynamic ULR, suddenly the xml loads "successfully", but is of status=-6, which means the xml is "malformed". Any idea at all what could cause this? The structure looks fine. I'm replacing <br> tags with <br/>, but they're in cdata wrappers anyway...
Any ideas?
Thanks!
-
Best thing to do is to get a tool like Fiddler (for IE) or LiveHTTPHeader (for FireFox) and to compare the difference between what is requested / returned from the browser bar and the Flash movie. For example, Flash may be sending data in POST format rather than GET or may be sending data that crashes your DB app.
-
Doesn't give me much
HI, thanks for the reply. I tried that after you suggested it. The results of the xml call, as listed by http live header, are listed below. (I put ** to hide the actual domain name and folder name)
-----------
***url to call xml was listed here****
GET /**Folder name**/cgi-bin/get_xml.cgi?mod=01&top=01 HTTP/1.1
Host: www.**.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Date: Tue, 22 Jul 2008 22:55:29 GMT
Server: Apache/2.2.9 (Unix) PHP/4.4.7 mod_ssl/2.2.9 OpenSSL/0.9.8c mod_fastcgi/2.4.6 DAV/2 SVN/1.4.2
Host: www.**domain here**.com
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 5906
Keep-Alive: timeout=2, max=98
Connection: Keep-Alive
Content-Type: text/xml
------------------
I suppose I should try an xml validator. The above info doesn't really tell me anything, does it?
Thanks!
-
I thought there was a different view in LiveHttpHeader that shows the actual post data - there is with Fiddler.
If you download and install fiddler (http://www.fiddlertool.com/fiddler/version.asp) then open your page in IE, Fiddler will list all your transactions. Click on the session view for both request and response and you will then be able to view the raw data that is sent and received in each case.
-
all flash cares about for "valid" xml is:
1) <?xml version="1.0" ?>
2) a root node
i'd pull in your XML as a string, trace it, see where the problem is, then fix it using string methods and then parse that as XML
and: hey gaius long time no see
-
Hi Mike,
Found a thread that implies I still owe you a biscuit, but it's probably stale by now.
Rather than doing a work-around, I'm curious to see why there is the difference between saved and web-served XML.
Like you say, Flash is _very_ (_too_) tolerant of rubbish XML, so there is no legitimate reason for the XML being malformed from the browser unless you get an error message from the server instead of valid XML - this is _very_ common.
EG: In the browser, you might see valid XML, but Flash sends invalid arguments that cause a code error so what Flash is receiving is more like:
"<h1>Error on line 256</h1><p>You have cocked up badly. Your membership to Nambla has been extended.</p>"
G
-
PS: you22, Mike has a point about tracing out what you receive if you can't be bothered to do the Fiddler thing. With AS 2, you can use onData rather than onLoad to access the raw data returned.
-
nambla lol - that scarred you permanently methinks
and with interest that biscuit is now worth a hefty sum
as far as the original thread: my guess is character encoding. that's the only thing i can think that'd change between server generated text and the same text saved locally.
-
Hi,
I don't know if http://board.flashkit.com/board/show...39#post4078639 is a similar issue? It's a pain in the bottom either way.
Gaius
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|