• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTML to XML Conversion and Vice Versa

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

Any opensource Java API that could be used for such a conversion?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd like to do something like wherein a user enters information on a HTML form, upon submit of that form, I have to represent the entire data as XML and later when the user wishes to see that HTML with data, the information is taken from the XML that I initially got. I also have to keep in mind the Roles and Rights when rendering the data. Any idea on any Java API's that could be used for this purpose?
 
Ranch Hand
Posts: 430
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I never did this, but searching in Google I found JAXP and HTML Tidy.

JAXP: XML -> HTML
HTML Tidy: HTML -> XML

I don't know if the inverse is also true.

http://www.ibm.com/developerworks/xml/library/x-jaxp/
http://www.ibm.com/developerworks/library/x-tiptidy.html
 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try XForms also.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you mean JTidy? I've never heard HTML Tidy. I'm looking for an OpenSource API that I can use to extend for my purpose that I mentioned in the post above. Is the HTML Tidy a Java API?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, let me explain what I'm trying to achieve here. I have a HTML form upon logging into an application. Now I enter some details in the form and I submit the form. Now what I want to happen is the entire HTML form must be captured along with the style information and depicted as a XML. Now later when the user comes and (the user has the option to view the filled HTML form) requests for the filled HTML form, I give him the XML which needs to now be represented as the HTML page output.

I guess we could use XSLT?? Am I right in this sense?
 
Ram Para
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this

http://www.w3schools.com/xforms/default.asp
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "style information"? HTML forms submit name/value pairs, nothing else.

How (and why) do you intend to store this information as XML, if later you need to output it as HTML?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:What do you mean by "style information"? HTML forms submit name/value pairs, nothing else.

How (and why) do you intend to store this information as XML, if later you need to output it as HTML?



I means the CSS styles. Yes, is the answer to your second question. Later I want to retrieve the output as HTML.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jothi Shankar Kumar wrote:

Ulf Dittmer wrote:What do you mean by "style information"? HTML forms submit name/value pairs, nothing else.

How (and why) do you intend to store this information as XML, if later you need to output it as HTML?



I means the CSS styles.


CSS styles are not submitted to the server - they are *generated* by the server and sent to the client. What exactly are you trying to do? Where is this style information coming from? What do you intend to do with it?

Yes, is the answer to your second question.


The question starts with "How (and why)..." - a "Yes" does not answer it.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a HTML form where the user enters some information in the HTML and later he decides to save that page or submit that page. Now when he does that I want to capture the entire page with data as an XML. Have a mapping kind of indormation and hit the database to save the XML id along with some other information. Later when the user tries to view the same page, I hit the database, get the correct XML id and look for that XML which will now be represented to the user on the screen as HTML.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, so there's really no style information to save at all. You already know all the styles used by the original form (after all, your web app generated it), so all you need to do is to style the web page showing the reconstituted data later on using the same styles.

So the question then boils down to - how to convert HTML form name/value pairs as XML, store it, retrieve it later, and then convert it back to HTML. That begs the question: why do you want to use XML? Why can't the name/value pairs be stored in a non-structured way in the DB (or as a property file, if your prefer that)?
 
They worship nothing. They say it's because nothing is worth fighting for. Like this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic