[Xerte] Having trouble reading XML from an external script
xerte at lists.nottingham.ac.uk
xerte at lists.nottingham.ac.uk
Fri Aug 24 17:40:58 BST 2007
Using Xerte 1.7
I am attempting to display some XML returned from an external PHP
script, and not having any success. Here is my script icon contents:
========
var xml_msg:String = "<params fname=\"Fred\" lname=\"Smith\" />";
var my_xml:XML = new XML(xml_msg);
var myReply:XML = new XML();
//reply.myText = "Supposed to be the reply from my PHP script";
//myReply.ignorewhite = true;
my_xml.sendAndLoad('http://localhost/test/test_xerte.php', myReply);
reply.myText = myReply.firstChild.attributes.value;
=========
My PHP script isn't doing anything with the data sent to it, it just
returns some XML:
=========
<?php # test_xerte.php
// this script is a test of whether I can connect to a php script
through Xerte.
echo '<?xml version="1.0" ?>
<reply value="Hello, World!" />';
?>
=========
I've also tried it without the '<?xml version="1.0" ?>' declaration in
my PHP script. In Xerte, I have a Text Display icon (id=reply) with
{myText} embedded. It displays "undefined" with the above code. If I
comment out the last two lines in the Xerte script icon, and uncomment
the reply.myText = "Supposed to be the reply from my PHP script" that is
what prints in Xerte.
I also get "undefined" if I paste '<reply value="Hello, World!" />' into
var myReply:XML = new XML('<reply value="Hello, World!" />') and comment
out the sendAndLoad line, so I have a feeling this problem has nothing
to do with the PHP script.
Any suggestions are greatly appreciated.
_____________________________
Paul Swanson
Instructional Designer
Harland Financial Solutions
_____________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20070824/9620c043/attachment.html
More information about the Xerte
mailing list