List Info

Thread: transportXML returns null?




transportXML returns null?
country flaguser name
United States
2007-09-27 17:39:01
Hi,

I want to load an XHTML file into DOM.  I issue Ajax.Request
and on
success do:
 var response=transport.responseXML

Response is null.  On the other hand:
  var response=transport.responseText;  // has the data.

Why is response=transport.responseXML returns null?

Here is the code:

    function display() {
       url = "http://"
+ location.hostname + port + "/fusion/
restlet/";
       url = url + "engines" + sServer;
        new Ajax.Request(url,
        {
            method:"get",
            contentType:"application/xhtml+xml",
            onSuccess: function(transport) {


                var response = transport.responseXML;    //
null ?
                //var response = transport.responseText;  //
OK

                alert("after response=" +
response);
                if (response != null) {
                alert("b=" +
response.getElementById('lastUpdate').innerHTML);  // this
never works
               }
                else
                    alert("onSuccess, responseXML is
null");
            },
            onFailure: function(){ alert("Cannot get
data from server:
" + location.host) }
        });
    }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=
en
-~----------~----~----~----~------~----~------~--~---


Re: transportXML returns null?
country flaguser name
United States
2007-09-27 18:16:52
You have to set a correct content-type (application/xml).

Regards,

Tobie

On Sep 28, 12:39 am, AlexK <alexkoif...gmail.com> wrote:
> Hi,
>
> I want to load an XHTML file into DOM.  I issue
Ajax.Request and on
> success do:
>  var response=transport.responseXML
>
> Response is null.  On the other hand:
>   var response=transport.responseText;  // has the
data.
>
> Why is response=transport.responseXML returns null?
>
> Here is the code:
>
>     function display() {
>        url = "http://" + location.hostname +
port + "/fusion/
> restlet/";
>        url = url + "engines" + sServer;
>         new Ajax.Request(url,
>         {
>             method:"get",
>            
contentType:"application/xhtml+xml",
>             onSuccess: function(transport) {
>
>                 var response = transport.responseXML;  
 // null ?
>                 //var response =
transport.responseText;  // OK
>
>                 alert("after response=" +
response);
>                 if (response != null) {
>                 alert("b=" +
> response.getElementById('lastUpdate').innerHTML);  //
this never works
>                }
>                 else
>                     alert("onSuccess, responseXML
is null");
>             },
>             onFailure: function(){ alert("Cannot
get data from server:
> " + location.host) }
>         });
>     }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=
en
-~----------~----~----~----~------~----~------~--~---


Re: transportXML returns null?
country flaguser name
United States
2007-09-28 00:48:33
This is what I added to the XHTML file that I get:

<meta http-equiv="Content-Type"
content="text/xml; charset=UTF-8" />

and this:

new Ajax.Request(url,
        {
            method:"get",
            contentType:"text/xml",
            onSuccess: function(transport) {

And I still get null:                var response =
transport.responseXML;

Thanks!
On Sep 28, 12:25 am, AlexK <alexkoif...gmail.com> wrote:
> Hi, this:
> contentType: "application/xml"
>
> did not change anything.  ANy other ideas?  Thanks.
>
> On Sep 27, 7:16 pm, Tobie Langel <tobie.lan...gmail.com> wrote:
>
> > You have to set a correct content-type
(application/xml).
>
> > Regards,
>
> > Tobie
>
> > On Sep 28, 12:39 am, AlexK <alexkoif...gmail.com> wrote:
>
> > > Hi,
>
> > > I want to load an XHTML file into DOM.  I
issue Ajax.Request and on
> > > success do:
> > >  var response=transport.responseXML
>
> > > Response is null.  On the other hand:
> > >   var response=transport.responseText;  //
has the data.
>
> > > Why is response=transport.responseXML returns
null?
>
> > > Here is the code:
>
> > >     function display() {
> > >        url = "http://" + location.hostname +
port + "/fusion/
> > > restlet/";
> > >        url = url + "engines" +
sServer;
> > >         new Ajax.Request(url,
> > >         {
> > >             method:"get",
> > >            
contentType:"application/xhtml+xml",
> > >             onSuccess: function(transport) {
>
> > >                 var response =
transport.responseXML;    // null ?
> > >                 //var response =
transport.responseText;  // OK
>
> > >                 alert("after
response=" + response);
> > >                 if (response != null) {
> > >                 alert("b=" +
> > >
response.getElementById('lastUpdate').innerHTML);  // this
never works
> > >                }
> > >                 else
> > >                     alert("onSuccess,
responseXML is null");
> > >             },
> > >             onFailure: function(){
alert("Cannot get data from server:
> > > " + location.host) }
> > >         });
> > >     }- Hide quoted text -
>
> > - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=
en
-~----------~----~----~----~------~----~------~--~---


Re: transportXML returns null?
country flaguser name
United States
2007-09-28 13:59:56
I use the following code in PHP to make sure my output is
interpreted
as XML

header("Content-Type: text/xml");

and this code for ColdFusion.

<cfheader charset="utf-8"
name="Content-type"
value="text/xml">


Cheers,
       Matt

On Sep 28, 1:48 am, AlexK <alexkoif...gmail.com> wrote:
> This is what I added to the XHTML file that I get:
>
> <meta http-equiv="Content-Type"
content="text/xml; charset=UTF-8" />
>
> and this:
>
> new Ajax.Request(url,
>         {
>             method:"get",
>             contentType:"text/xml",
>             onSuccess: function(transport) {
>
> And I still get null:                var response =
> transport.responseXML;
>
> Thanks!
> On Sep 28, 12:25 am, AlexK <alexkoif...gmail.com> wrote:
>
> > Hi, this:
> > contentType: "application/xml"
>
> > did not change anything.  ANy other ideas? 
Thanks.
>
> > On Sep 27, 7:16 pm, Tobie Langel
<tobie.lan...gmail.com> wrote:
>
> > > You have to set a correct content-type
(application/xml).
>
> > > Regards,
>
> > > Tobie
>
> > > On Sep 28, 12:39 am, AlexK
<alexkoif...gmail.com> wrote:
>
> > > > Hi,
>
> > > > I want to load an XHTML file into DOM. 
I issue Ajax.Request and on
> > > > success do:
> > > >  var response=transport.responseXML
>
> > > > Response is null.  On the other hand:
> > > >   var response=transport.responseText; 
// has the data.
>
> > > > Why is response=transport.responseXML
returns null?
>
> > > > Here is the code:
>
> > > >     function display() {
> > > >        url = "http://" + location.hostname +
port + "/fusion/
> > > > restlet/";
> > > >        url = url + "engines" +
sServer;
> > > >         new Ajax.Request(url,
> > > >         {
> > > >             method:"get",
> > > >            
contentType:"application/xhtml+xml",
> > > >             onSuccess:
function(transport) {
>
> > > >                 var response =
transport.responseXML;    // null ?
> > > >                 //var response =
transport.responseText;  // OK
>
> > > >                 alert("after
response=" + response);
> > > >                 if (response != null) {
> > > >                 alert("b=" +
> > > >
response.getElementById('lastUpdate').innerHTML);  // this
never works
> > > >                }
> > > >                 else
> > > >                    
alert("onSuccess, responseXML is null");
> > > >             },
> > > >             onFailure: function(){
alert("Cannot get data from server:
> > > > " + location.host) }
> > > >         });
> > > >     }- Hide quoted text -
>
> > > - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffsgooglegroups.com
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=
en
-~----------~----~----~----~------~----~------~--~---


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )