How do I load xml string from AJAX.LastData?

Get help using Construct 2

Post » Sun Jun 15, 2014 2:09 am

I checked out the XML example .capx and it looked pretty straightforward. So I created a new project file with the same info in it as the xml string in the example, loaded it via AJAX, and then attempted to load AJAX.LastData as the XML string, but i'm not getting anything to parse through. In debug if i look at the AJAX object I see the correct project file string in there. Any ideas?

You do not have the required permissions to view the files attached to this post.
Posts: 7
Reputation: 189

Post » Sun Jun 15, 2014 2:17 pm

You say your project file has the same info as the xml string in the example. Did you remove the extra quotation marks?

When you load from string the xml is wrapped in double quotes and double quotes inside the xml are escaped with extra double quotes:
Code: Select all
"<?xml version=""1.0"" ?> ..."

But in the file you should just have:
Code: Select all
 <?xml version="1.0" ?> ...
Posts: 1,520
Reputation: 25,850

Post » Sun Jun 15, 2014 2:36 pm

THANK YOU! That did it. I had removed the quotes surrounding the whole thing, but didn't even consider removing the double quotes. THANKS!

A second question, if you don't mind. While trying to solve this problem I read some worrisome things about xml not being supported by some export options Construct 2 has. Like CocoonJS, and some others. Is that something I should worry about? Should I switch to a different format? Like JSON?

Posts: 7
Reputation: 189

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests