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"?>
<info>HELLOWORLD</info>


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.


----EDIT----


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?


----EDIT----

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
B
4
Posts: 8
Reputation: 341

Post » Mon Jul 16, 2012 2:52 pm

@GLaDOS9000 can you share your .capx?
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Mon Jul 16, 2012 4:01 pm

I can but I don't think it'll be of any use....
B
4
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.
B
15
S
4
G
3
Posts: 52
Reputation: 1,513

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: bclikesyou, newt, Ragevortex, Robin Sommer and 12 guests