Solved

How to serialize a generic JavaScript object to XML

Posted on 2009-05-07
2
265 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 125 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

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…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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

738 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