Two Laptop Bag*
The moose likes HTML, CSS and JavaScript and the fly likes JavaScript - XML Binding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "JavaScript - XML Binding" Watch "JavaScript - XML Binding" New topic
Author

JavaScript - XML Binding

Dhruv Chandna
Greenhorn

Joined: May 16, 2008
Posts: 5
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

Joined: Jul 16, 2008
Posts: 61
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.


<a href="http://www.thinkinginjavascript.com" target="_blank" rel="nofollow">my OOJS book</a>
Dhruv Chandna
Greenhorn

Joined: May 16, 2008
Posts: 5
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

Joined: Jan 10, 2002
Posts: 60071
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaScript - XML Binding
 
Similar Threads
Origin of request data when implementing the front controller pattern
Write to XML using JavaScript
using document.XMLDocument in Mozilla
Java Web Services 2
Marshalling and UnMarshalling