<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>Having trouble reading XML from an external script</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Using Xerte 1.7</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I am attempting to display some XML returned from an external PHP script, and not having any success. Here is my script icon contents:</FONT></P>
<P><FONT SIZE=2 FACE="Arial">========</FONT>
<BR><FONT SIZE=2 FACE="Arial">var xml_msg:String = "<params fname=\"Fred\" lname=\"Smith\" />";</FONT>
<BR><FONT SIZE=2 FACE="Arial">var my_xml:XML = new XML(xml_msg);</FONT>
<BR><FONT SIZE=2 FACE="Arial">var myReply:XML = new XML();</FONT>
<BR><FONT SIZE=2 FACE="Arial">//reply.myText = "Supposed to be the reply from my PHP script";</FONT>
<BR><FONT SIZE=2 FACE="Arial">//myReply.ignorewhite = true;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">my_xml.sendAndLoad('<A HREF="http://localhost/test/test_xerte.php'">http://localhost/test/test_xerte.php'</A>, myReply);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">reply.myText = myReply.firstChild.attributes.value;</FONT>
<BR><FONT SIZE=2 FACE="Arial">=========</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">My PHP script isn't doing anything with the data sent to it, it just returns some XML:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">=========</FONT>
<BR><FONT SIZE=2 FACE="Arial"><?php # test_xerte.php</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">// this script is a test of whether I can connect to a php script through Xerte.</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">echo '<?xml version="1.0" ?></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <reply value="Hello, World!" />';</FONT>
<BR><FONT SIZE=2 FACE="Arial">?> </FONT>
<BR><FONT SIZE=2 FACE="Arial">=========</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">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.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">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.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Any suggestions are greatly appreciated.</FONT>
</P>
<BR>
<BR>
<P><FONT COLOR="#808080" SIZE=2 FACE="Courier New">_____________________________</FONT>
</P>
<P><FONT COLOR="#808080" SIZE=2 FACE="Courier New"><B> Paul Swanson</B></FONT>
<BR><FONT COLOR="#808080" SIZE=2 FACE="Courier New"> Instructional Designer</FONT>
<BR><FONT COLOR="#808080" SIZE=2 FACE="Courier New"> Harland Financial Solutions</FONT>
<BR><FONT COLOR="#808080" SIZE=2 FACE="Courier New">_____________________________</FONT>
</P>
</BODY>
</HTML>