creating html page from xml file

荒凉一梦 提交于 2019-12-11 10:49:02

问题


I reading xml document which consists 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.


回答1:


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

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




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/6608257/creating-html-page-from-xml-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!