The request response is plain xml with no comments.Mootools getElement
function does not work on IE browsers, I can't remember the JS error right
now.

I'm trying to create an example, but I can't find how to parse an xml string
into an xml document in mootools. Any ideas?
var xml =
"<root><node>node1</node><node>node2</node><node>node3</node></root>";
$(xml) returns null (I expected that but... had to try)


2009/6/18 Fábio Costa <[email protected]>

> Do you get any errors?Thanks for this report.
>
>
> Fábio Miranda Costa
> Engenheiro de Computação
> http://meiocodigo.com
>
>
>
> On Thu, Jun 18, 2009 at 8:58 AM, bluff <[email protected]> wrote:
>
>>
>> Are the comments in the request reply. if so IE cannot handle this and
>> will always fail.
>> Solution remove the comments from the request reply
>>
>> On Jun 17, 11:56 pm, Eneko Alonso <[email protected]> wrote:
>> > I sent an email a copule of weeks ago about an issue parsing XML withg
>> > Mootools on IE browsers, something that jQuery does fine, as you can see
>> on
>> > the next example.Notice the ajax request is done in Mootools, even when
>> the
>> > xml is parsed by jQuery.
>> >
>> > On this project I have both Mootools and jQuery, so I'm fine, but what
>> if I
>> > had only Mootools?
>> >
>> >         this.request = new Request({
>> >             method: 'get',
>> >             url: this.gallery.photosFeed + '&' +
>> Hash.toQueryString({start:
>> > 0, end: 10}),
>> >
>> >             onSuccess: function(text, xml) {
>> >                 if (!$defined(xml)) {
>> >                     console.warn('Gallery XML is empty.')
>> >                     return;
>> >                 }
>> >
>> >                 // *** MOOTOOLS CODE FAILS ON IE BROWSERS ***
>> >                 // xml.getElements('document').each(function(photo,
>> index) {
>> >                 //     var pic = {
>> >                 //         docId:
>> >     photo.getElement('fileentryid').get('text'),
>> >                 //         userId:
>> >    photo.getElement('userid').get('text'),
>> >                 //         title:
>> photo.getElement('title').get('text'),
>> >                 //         ownerName:
>> > photo.getElement('userfullname').get('text'),
>> >                 //         rating:
>> >    photo.getElement('rating').get('text').toFloat(),
>> >                 //         created:   new
>> > Date(photo.getElement('createdate').get('text') * 1000),
>> >                 //         images:   {}
>> >                 //     }
>> >                 //     photo.getElements('image').each(function(image) {
>> >                 //         pic.images[image.get('label')] =
>> > image.getElement('url').get('text')
>> >                 //     });
>> >                 //     var photoThumb = new PhotoThumb({data: pic});
>> >                 //     this.gallery.photos.push(photoThumb);
>> >                 //     this.photosList.grab(photoThumb.element);
>> >                 // }.bind(this));
>> >
>> >                 jQuery(xml).find('document').each(function(index, photo)
>> {
>> >                     photo = jQuery(photo);
>> >                     var pic = {
>> >                         docId:     photo.find('fileentryid').text(),
>> >                         userId:    photo.find('userid').text(),
>> >                         title:     photo.find('title').text(),
>> >                         ownerName: photo.find('userfullname').text(),
>> >                         rating:
>>  photo.find('rating').text().toFloat(),
>> >                         created:   new
>> Date(photo.find('createdate').text()
>> > * 1000),
>> >                         images:   {}
>> >                     }
>> >                     var images = photo.find('image');
>> >                     images.each(function() {
>> >                         var image = jQuery(this);
>> >                         pic.images[image.attr('label')] =
>> > image.find('url').text();
>> >                     });
>> >
>> >                     // This code does not change from avobe
>> >                     var photoThumb = new PhotoThumb({data: pic});
>> >                     this.gallery.photos.push(photoThumb);
>> >                     this.photosList.grab(photoThumb.element);
>> >                 }.bind(this));
>> >             }.bind(this),
>> >
>> >             onFailure: function() {
>> >                 console.warn('Gallery feed could not be loaded.');
>> >             }
>> >         });
>> >         this.request.send();
>>
>
>

Reply via email to