aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes javascript library which can convert html form to an xml ? 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 library which can convert html form to an xml ?" Watch "javascript library which can convert html form to an xml ?" New topic
Author

javascript library which can convert html form to an xml ?

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I need to use DWR to work on a html form. Do we have any javascript library which can convert html form elements/values to an xml ?

Thanks.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What, specifically, are you trying to do? It's unusual you'd need to do this.
Bart Stanz
Greenhorn

Joined: Feb 06, 2010
Posts: 13
Do you mean taking form output and saving it as an xml file?


www.bartium.com
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
David Newton wrote:What, specifically, are you trying to do? It's unusual you'd need to do this.


Using DWR Ajax to call server, I want to send xml in and get xml out. so I need to get user form input and convert it into xml. I did some research, found XForm will achieve this, but XForm is not that much supported in browser. Do we have a javascript library, like JQuery.., to convert this ?

Thanks.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Reason you do not send up a normal form submission to the server?

Eric
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
Eric Pascarello wrote:Reason you do not send up a normal form submission to the server?


to achieve a kind of SOA, decouple UI from server, in the service side, we use XML-in-and-XML-out, then we will have no any pain to develop a desktop UI.

My design is like this, service side accept XML in, then use XStream map to Object, finish business logic, use XStream decode Object to XML and return it to user. In html client, we use DWR to call this service, In Desktop client, use web service to call service.

Usually we can easily get user form input in JSon format, but this is not XML, then in service side, I have to use another convert...
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://www.docunext.com/blog/2009/01/convert-form-data-to-xml-with-jquery.html

Although really I'd do this on the server side by making JSON and XML request handlers (and HTML as well, in case the client has JavaScript turned off).
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I agree with David, if you need to do the XML, that means your users will have to have JavaScript enabled.

I still think that it should be done on the server, seems logical to me to do it there.

How are you going to do the validation and such with the server? Seems like you are making more work to make it simplifier to make a client app.

You can look at stuff like http://xmljs.sourceforge.net/, but it would be a lot easier to just build it yourself.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javascript library which can convert html form to an xml ?
 
Similar Threads
conversion of xml to jsp using Javascript
Html to database
XML to HTML using JavaScript
converting HTML form to XML
"nested forms" in JSF?