XML Blues

Discussion and feedback on Construct 2

Post » Mon Jul 16, 2012 2:30 pm

So I've been having a really hard time with xml too, and I've tried all the stuff on this page including what zedden did and I just can't get it to show up.

I'm using ajax to load a file, then having an XML object load AJAX.LastData, and the text object display XML.StringValue("info").

Here's my XML:

<?xml version="1.0" encoding="ISO-8859-1"?>

And before you ask:

Yes, ajax is loading it, I can put AJAX.LastData in the text object and I get my xml back.

Yes, I have XML set to global and in the layout.

Yes, I've tried putting the XML directly in to no avail.

Thanks in advance.


Ok I posted this a bit too soon. After messing with my stuff I managed to get the error: Extra content at the end of the document

Do I need a closing tag for xml files?


Ok I solved my own problem. In XML you need to have one root node in which everything resides. I didn't know this before. Hopefully this post will at least help someone else with the same problem.GLaDOS90002012-07-16 15:04:17
Posts: 8
Reputation: 341

Post » Mon Jul 16, 2012 2:52 pm

@GLaDOS9000 can you share your .capx?
Scirra Founder
Posts: 25,073
Reputation: 199,682

Post » Mon Jul 16, 2012 4:01 pm

I can but I don't think it'll be of any use....
Posts: 8
Reputation: 341

Post » Wed Feb 26, 2014 12:10 pm

I was glad to find this topic!!!
As Ashley already said:
" You should make sure you use valid and complete XML documents, which start with "<?xml ...". "

First I made the same mistake and played around only with XML elements and didn't bother about the XML header. But when my PHP file echoed the missing starter line "<?xml ..." all was well :D

For your info:
For XML output in PHP I use the object XMLWriter() and the method startDocument('1.0','UTF-8') does the trick with the needed header.
Posts: 52
Reputation: 1,513


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests