If you are only using for server-client communications, you might consider JSON. I needed something very basic as well, but just decided to go with JSON instead of XML since it has less markup and is just plain simpler. Using XML with prototype was more trouble than it was worth for me. Usage is simple as can be, just call json_encode or json_decode (I use PHP but I'm sure similar functions are available for whatever you use).

JS version of json_decode:
function json_decode(txt){
    var r = null;
    eval('r='+txt+';');
    return r;
}

If you must use XML, I don't know of anything very lightweight and simple but I'd love to see something like what you're talking about.

Thanks,
Colin


Gregory Hill wrote:

Anyone know of a _javascript_ function that will take an xml document and turn it into an associative array?

Basically it would take something like this:

<body>
<item>

<id>1</id>
<name>Bob</name>
</item>
<item>
<id>2</id>
<name>John</name>
</item>
</body>


And turn it into something  like this:

{

            itemList: [

{

id: 1,

name: ‘Bob’

},

{

id: 2,

name: ‘John’

}

]

}

 

If not, I’m gonna build one.

 

Greg


_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs



_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to