Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaScript - XML Binding

 
Dhruv Chandna
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Is there anything for Javascript that resembles the Java-XML object binding. I am developing an Ajax application and just thought it would be convenient if there was a provision to convert the XML to an appropriate Javascript object.

What are the pros and cons of having such a library. I'd like to make one if it does not exist already. But I am not sure where to make a start.

Thanks,
Dhruv
 
Stoyan Stefanov
author
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before you dive into this, is it an option to consider moving towards JSON as a data transfer format. It's leaner to transfer (less bytes) and definitely easier on the client side.

On the server side you can either ditch XML and return JSON or have some sort of XML-2-JSON going on on the server.

In PHP for example, there's a simple function which can take an array or an object and turn it into a JSON string.
 
Dhruv Chandna
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for your reply. I checked up JSON and it looks very interesting as a JSON string is implicitly considered as a JavaScript object. This is exactly what I was looking for.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64851
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stoyan Stefanov:
Before you dive into this, is it an option to consider moving towards JSON as a data transfer format. It's leaner to transfer (less bytes) and definitely easier on the client side.


Quoted for emphasis.

I can't remember the last time I returned XML from an Ajax request.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic