Never used XML as of now but JSON. It might be possible to JSON.encode() the whole XML data and reference the stuff the object way. If the JSON.encode() would work, it would even make your code shorter - worth a try i think.
On 18 Okt., 04:12, Manu <[email protected]> wrote: > hey everybody! > This is my first post here, so I'll say hello first. > > My name is Manuel, and I study Software Eng. in Argentina. > I've been using mootools for about a year now, and every day > I'm surprised by the magic you can do with it :D > Hmmm... well > > I'm doing a web where I heavily use AJAX requests to > a XML service. In fact, my web is a fronte-nd with almost > no server whatsoever and uses AJAX to communicate with > the back-end. > > Everything was going fine (I developed and tested in Ubuntu 9.04 > and Firefox 3.0 as a browser). > One day I decided to see how my web did in IE8... > horror! > > Nothing was working as it marvelously did in Firefox. > To be more specific, the Request.HTML's were not working. > As I said, my web relied heavily on that, so nothing worked. > > I spent a day trying to get something running but I had no luck.. > The only conclusion to which I arrived was that the XML was > incorrecltly parsed > (I hope I'm in mistake). Let's get to the code: > > var req = new Request.HTML({ > url: 'service/Catalog.groovy', > > onSuccess: function(responseTree, responseElements) { > > var catz = responseElements.filter('category'); > catz.each(function(cat){ > // cat = $(cat); > var cat_id = cat.get('id'); > var subcategory = cat.getElement('subcategory'); > alert(cat_id); > alert(cat.get('html')); > alert(subcategory.get('html')); > } > }, > onFailure: function(){...} > > }); > > for example, that piece of code. > In firefox, it worked perfectly. It alerted an ID (for example, 7), > then it showed the contents of the category element, for example: > <subcategory id='1'> > <category_id>7</category_id> > <code>ACTIO</code> > <name>Action</name> > </subcategory> > and then it showed the contents of some inner element, in this case: > <category_id>7</category_id> > <code>ACTIO</code> > <name>Action</name> > > In IE8, the first alert worked OK (alerted 7) > but the next alert (alert(cat.get('html'));) gave an empty string > and the last threw an Exception... it said something about subcategory > beeing null. > > What I concluded with this all is that the elements where parsed > correctly > in Firefox, but in IE8 I only got the tags and the attributes OK, > everything else > was completely wrong (in fact, missing). I mean, the inner content of > all the > elements of the response where gone! > > Other fact you could use: this code: > alert(cat.get('tag')); resulted in > Firefox: category > IE8: /category <-----------(?) > > hmm what else... > oh yeah... the line you see commented above (cat = $(cat);) was > something > I tried to do to fix this. I read in the mootools Docs that IE needed > to explicitly call > the $ function on elements to get all the Element-magic ... but this > didn't fix anything. > > I was so desperate... I even fiddled arround with mootools.js' code > > OK, so... > What I want you, dear mootool-pro's is to help me solve this problem, > for I REALLY need the web to function in IE8, and in fact I chose > mootools > to forget about compatibility problems... > > Well... sorry for my shaky english and post length! > Thanks a million in advance! > > Manuel > > ps: if something is not clear, please ASK! I'd appreciate any help :D
