Bookmark Topic Watch Topic
  • New Topic

What is the best way to transform XML to HTML?

 
Mattew Lee
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi everybody,

Nobody answered my previous question! I decided to change my question style.
I need to read a XML file in order to generate a HTML web page from that XML.

What is your solution?

Cheers,
 
ash neet
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Report post to moderator
Do you want to create the HTML using the nodes of the XML?
 
Tim Holloway
Bartender
Posts: 18413
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
Welcome to the JavaRanch, Mattew!

I tend to grate my teeth when I hear the word "best", as it frequently is meaningless. The real world is a bit too complicated for "one-size-fits-all" solutions.

However, a popular approach is to use XSL, since you can use a generic engine and a set of transformation rules instead of having to hard-code everything. Although the transformation rules can result in insanity all by themselves.

You can do XSL-based transformations either client-side or server-side, since most web browsers have XSLT capabilities. Server-side gives more consistent results, but client-side offloads some of the work, and in some instances, the amount of data that needs to be sent may be smaller.

Apache Cocoon is a project that provides a webapp that's pretty much based on XSLT from start to end and has many powerful features, including an implementation of the Pluto web portal and PDF generation.
 
Mattew Lee
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Report post to moderator
ash neet wrote:Do you want to create the HTML using the nodes of the XML?


Nodes of XML + data between nodes.

 
Mattew Lee
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanks for your guides and welcome message, I used Servlet to achieve this goal but have problem with Servlet, please look at the following link and let me know if you can help me:

http://www.coderanch.com/t/521355/Servlets/java/Servlet-XML-Transformation

If know any better way of doing this Server-side please let me know.
After I make it, I'm going to merge it in Spring Web MVC so if you know anyway of doing this right away in Spring Web MVC don't hesitate to mention it.

Cheers,
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Mattew Lee wrote:Nobody answered my previous question!

You waited what? 4 hours? While most people who post here were asleep? What did you expect?
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!