开发者

creating html page from xml file

开发者 https://www.devze.com 2023-03-17 17:39 出处:网络
I reading xml document which consists开发者_StackOverflow社区 of html elements. Now I need to fetch the data from that xml file and construct a HTML and display it using servlets or javascript. How do

I reading xml document which consists开发者_StackOverflow社区 of html elements. Now I need to fetch the data from that xml file and construct a HTML and display it using servlets or javascript. How do I do that, please suggest any method or tutorials.


You could use XSLT to transform your XML document into an XHTML page.

There's an open-source XSLT servlet available here.


You should use XSLT for this task. Start with a basic tutorial.


Basically, in java there are 3 apis to read and parse xml data: * dom: reads whole file at once and lets you access data with random access. high memory usage. * sax: stream-reads file and lets you react on events. Low memory usage, more complicated than dom. * stax: similar to sax, but more modern interface, event based. also low memory usage.

How to present the information from the HTML file cannot be explained in a single answer here, hundreds of books were written about that. Among the possibilities are: You can do HTML creation yourself (prgramatically in java) or you could use JSP, JSF, Ruby on Rails, XSLT, Velocity, GWT, Tapestry, Wicket, JBoss Seam, WebWork, just to name a few.

0

精彩评论

暂无评论...
验证码 换一张
取 消