?
Solved

How to serialize a generic JavaScript object to XML

Posted on 2009-05-07
2
Medium Priority
?
269 Views
Last Modified: 2012-05-06
Does one of the mainstream JavaScript libraries (YUI, jQuery, Dojo) provide a way to serialize a JavaScript object to XML (as text)?

Note: I'd like to transform a generic JavaScript object in general, not just a DOM.
0
Comment
Question by:avernet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
alien109 earned 500 total points
ID: 24332004
not mainstream, however and I haven't tested it - but thought I'd throw it your way anyway...
http://svn.mirekrusin.com/pub/javascript/to_xml/trunk/to_xml.js
0
 
LVL 1

Author Comment

by:avernet
ID: 24352094
@alien109 Thank you for the link! I found a few problems with this code, but it is a good start. I put some comments below in case the author finds this, or if someone wants to improve on this:

* No license is mentioned. (I will try to contact the author about it.)
* Doesn't handle arrays well. (It creates elements <1>, <2>... )
* Fails when an object has a property which value is undefined. I.e. the property exists, but its value is undefined.

Still, it's some great code to start with.

Alex
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question