Hey guys try this:

var destinationEl = new Element( 'div', { 'html':
responseXmlFromYourRequest } );
destinationEl.getElements( 'somethingInTheXML' ).each( function( el )
{
    console.log( #someEl );
} );

On Jun 19, 4:39 am, Fábio Costa <[email protected]> wrote:
> Ill really take a deep look at this.
> Thanks.
>
> Fábio Miranda Costa
> Engenheiro de Computaçãohttp://meiocodigo.com
>
> On Thu, Jun 18, 2009 at 6:52 PM, Eneko Alonso <[email protected]>wrote:
>
>
>
> > Yep, that does not work...
>
> > I've been looking at jQuery's source code but I can't find how do they
> > hanlde the XML so well for all browsers.
> > Any ideas?
>
> > I've seen some code to create a Request.XML class that basically converts
> > the xml onto a DOM tree, but that has a bunch of issues on IE browsers too,
> > as we have talked before (for example, IE wont let you create an <image>
> > node).
>
> > 2009/6/18 Fábio Costa <[email protected]>
>
> >> extending the xml doesnt work, right?i mean like:
>
> >> $(xml).getElements........
>
> >> Fábio Miranda Costa
> >> Engenheiro de Computação
> >>http://meiocodigo.com
>
> >> 2009/6/18 Fábio Costa <[email protected]>
>
> >>> Eneko thats a serious issue, im sure core devs are with an eye on it.But
> >>> i *think *it only come for the 2.0 series.
>
> >>> Fábio Miranda Costa
> >>> Engenheiro de Computação
> >>>http://meiocodigo.com
>
> >>> On Thu, Jun 18, 2009 at 1:16 PM, Eneko Alonso 
> >>> <[email protected]>wrote:
>
> >>>> 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