Parsing XML with RightJS in IE6/8

12 views
Skip to first unread message

Nevin

unread,
May 12, 2011, 9:05:29 AM5/12/11
to RightJS
I am trying to use RightJS in a new project. What I am trying to do
is:

1) Having a XHR request to the server
2) Retrieve a XML back
3) Parse the XML and update the page accordingly

The code works for Firefox and Safari but when I try to load it with
IE I got a:

--> Object doesn't support this property or method error

The code is simplified as follow:

1: Xhr.load('get_xml.php', {
2: onSuccess: function(r) {
3: var xml_obj = $(r.repsonseXML);
4: var children = xml_obj.find('my_node');
5: }
6: });

on line 3 IE gives an error. Is it related to RightJS unable to handle
Microsoft XML obj?

Is that the proper way to handle XML in RightJS?

Nikolay Nemshilov

unread,
May 13, 2011, 1:25:30 AM5/13/11
to rig...@googlegroups.com
Hi Nevin,

I doubt it will work like that in IE. RightJS is made to handle html-elements and there is no guarantee that it will work with any sort of XML as well.

To handle this, you might want to use pure DOM methods instead, like that

var xml = r.responseXML;
var smth = xml.getElementsByTagName('somthing')[0];
// etc.


or use JSON. no one really uses XML anymore

--
Nikolay

> --
> You received this message because you are subscribed to the Google Groups "RightJS" group.
> To post to this group, send email to rig...@googlegroups.com.
> To unsubscribe from this group, send email to rightjs+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/rightjs?hl=en.
>

--
Nikolay V. Nemshilov
The Web-Developer

Reply all
Reply to author
Forward
0 new messages