hi, i'm using requestbuilder to communicate with php.

i used a XMLWriter to place the sql result in xml:

    $writer = new XMLWriter();
    $writer->openMemory();
    $writer->startDocument('1.0', 'UTF-8');
    $writer->setIndent(4);
    $writer->startElement("result");
    for($row = 0; $rowdata = mysql_fetch_array($result); $row++){
        $writer->startElement("row");
        $writer->writeAttribute("index", $row);
        for($col = 0; $col < count($rowdata)/2; $col++){
            $writer->startElement("column");
            $writer->writeAttribute("index", $col);
            $writer->text($rowdata[$col]);
            $writer->endElement();
        }
        $writer->endElement();
    }
    $writer->endElement();
    $writer->endDocument();
    echo $writer->outputMemory();


when i view it in a browser it perfectly fine, this is the page source
content:

<?xml version="1.0" encoding="UTF-8"?>
<result>
 <row index="0">
  <column index="0">1</column>
  <column index="1">abc</column>
  <column index="2">123</column>
 </row>
 <row index="1">
  <column index="0">2</column>
  <column index="1">def</column>
  <column index="2">456</column>
 </row>
 <row index="2">
  <column index="0">3</column>
  <column index="1">ghi</column>
  <column index="2">789</column>
 </row>
</result>

it looks fine. but when i try to get the data using request builder
and use Window.alert:

RequestBuilder builder = new RequestBuilder(RequestBuilder.POST,
script);
builder.setHeader("Content-Type", "application/x-www-form-
urlencoded");
builder.sendRequest("", new RequestCallback() {
    public void onResponseReceived(Request request, Response response)
{
        Window.alert(response.getText());
    }

    public void onError(Request request, Throwable exception) {
        Window.alert("Error: " + exception.toString());
    }
});

the output i get is:

<?xml version="1.0" encoding="UTF-8"?>
<result/>

any idea what happened to the content of the document?


i even tried to make the script simple:

    $output = "";
    $output = $output . '<?xml version="1.0" encoding="UTF-8"?>';
    $output = $output . '<result>';
    for($row = 0; $rowdata = mysql_fetch_array($result); $row++){
        $output = $output . '<row index="' . $row .'">';
        for($col = 0; $col < count($rowdata)/2; $col++){
            $output = $output .  '<column index="' . $col .'">';
            $output = $output .  $rowdata[$col];
            $output = $output .  '</column>';
        }
        $output = $output .  '</row>';
    }
    $output = $output .  '</result>';
    echo $output;

i get the correct output in php but i still get the same empty
document
in the response

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to