Dude, I haven't tried this so I don't know if something like this
works flawless, but why not convert the stuff to json?
http://www.thomasfrank.se/xml_to_json.html - there are a lot of
comments, so i dunno if this is good, but here's a recent thing:
http://mitya.co.uk/scripts/XML-to-JSON-convertor-and-remapper-144
maybe port it too moooo

I'm in a hurry, but maybe there's a 100% working php xml2json to make
your life even more easy ;)

I rather mess with json than having to do it 2 ways to get it right
for different browsers you know.



On Nov 26, 6:08 pm, stratboy <[email protected]> wrote:
> Interesting but I don't like it too much. 2 things:
> - not always you can use namespaces
> - xml is good mainly because is readable and simple to write. Adding
> namespaces it gets less readable and more error prone.
>
> Anyway, I've found my way:
>
> <!-- not well formed, but it's for testing purposes -->
> <?xml version="1.0" encoding="utf-8"?>
> <regioni>
>     <regione>
>         <nome>argentina</nome>
>         <id>22</id>
>     </regione>
>     <regione>
>         <nome>australia</nome>
>         <id>23</id>
>     </regione>
>         <regione id="22">argentina</regione>
>         <regione id="23">australia</regione>
>         <regione id="22" nome="argentina" />
>         <regione id="23" nome="australia" />
> </regioni>
>
> var RelessersManager = new Class({
>
>         initialize: function(){
>                 this.init()
>         },//end init
>
>         init:function(){
>                 var r = new Request({
>                         method:'get',
>                         autoCancel:true,
>                         url:'../test-dealers.xml',
>                         onRequest:function(){
>                                 //placeholder
>                         }.bind(this),
>                         onSuccess:function(text,xml){
>                                 this.parseRegions(xml)
>                         }.bind(this),
>                         onFailure:function(transport){ 
> alert('RelessersManager::xml loading
> error'); }
>                 }).send();
>         },
>
>         parseRegions:function(xml){
>                 var regioni = Slick.search(xml,'regione');
>
>                 alert(regioni[3].getAttribute('id'));//works on ie7/8 and 
> safari +
> ff
>                 alert(regioni[3].childNodes[0].nodeValue);//works on ie7/8 and
> safari + ff
>
>                 var obj = Slick.find(regioni[0],'nome');
>                 alert(obj.childNodes[0].nodeValue);//works on ie7/8 and 
> safari + ff
>         }
>
> });
>
> -----
>
> Quite fine for me.
> Still though, I'd like mootools to have a more robust xml support,
> since here I'm using some native js, that implies a weird thing like
> childNodes[0]. You know, I'm used to E4X in actionscript.. ;)
>
> Bye!!!
>
> On 26 Nov, 10:46, Sanford Whiteman <[email protected]>
> wrote:
>
>
>
> > > There's a problem. Explorer. As always.
>
> > In  MSXML,  always think namespaces.  IE is actually quite robust with
> > XML.
>
> >    http://jsfiddle.net/CnPZB/1/
>
> > Tested IE7, IE8, FF 3.6, Chromium nightly.
>
> > -- Sandy

Reply via email to