Loading ...
Sorry, an error occurred while loading the content.

Problem processing XML reponse from YAHOO.util.Connect.asyncRequest

Expand Messages
  • Nick Weavers
    Hi, I have a php function that is invoked by an asyncRequest that returns xml as follows: $_xml = ; $_xml =
    Message 1 of 2 , Dec 31, 2006
    • 0 Attachment
      Hi,

      I have a php function that is invoked by an asyncRequest that returns
      xml as follows:

      $_xml ='<?xml version="1.0" standalone="yes"?>';
      $_xml = '<file_upload>';
      $_xml .= ' <success>'.$success.'</success>';
      $_xml .= ' <error_message>'.$error_message.'</error_message>';
      $_xml .= ' <temp_filename>'.$base_file.'</temp_filename>';
      $_xml .= '</file_upload>';
      echo $_xml;

      The javascript (first few lines shown below) in the upload response
      which processes the XML-DOM works just fine in Firefox but in IE7
      gives a syntax error popup saying "Line: 518, Char:3, Object required".

      518 var xmlDocument = o.responseXML;
      519 var success =
      xmlDocument.getElementsByTagName("success")[0].firstChild.nodeValue;
      520 // If the file upload was not a success show the error message and
      exit
      521 if (success == 'FALSE') {
      522 var error_message =
      xmlDocument.getElementsByTagName("error_message")[0].firstChild.nodeValue;
      523 errorMessagesDiv.innerHTML = "Error: " + error_message + "
      Please choose a larger image.";
      524 errorMessagesDiv.style.display = "block";
      525 return;
      526 }

      If I change line 518 to

      var xmlDocument = new Object;
      xmlDocument = o.responseXML;

      IE7 seems to be happy with that but then issues the same syntex error
      for line 519.

      Can someone tell me what I am doing wrong.

      Many thanks,
      Nick.
    • Nick Weavers
      Spotted my dumb error: $_xml = ; $_xml = ; Second assignment should be an append to current string type
      Message 2 of 2 , Dec 31, 2006
      • 0 Attachment
        Spotted my dumb error:

        $_xml ='<?xml version="1.0" standalone="yes"?>';
        $_xml = '<file_upload>';


        Second assignment should be an append to current string type assignment:
        $_xml .= '<file_upload>';

        Interesting that Firefox ignored the missing xml header.

        Thanks,
        Nick.
      Your message has been successfully submitted and would be delivered to recipients shortly.