This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Servlets and the fly likes connecting to xml from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "connecting to xml from servlet" Watch "connecting to xml from servlet" New topic

connecting to xml from servlet

bernd pier
Ranch Hand

Joined: Jun 21, 2002
Posts: 30
hey,there in the outerspace;
is there a simple way to connect to a xml file from a servlet.
i have a servlet, that creates a xml file and i want to display this xml file in a browser from this servlet.
sounds complicated?
ok, the basic question is:
i have a servlet and a xmlfile(with a xslfile) and i want the servlet to call the xml file, just like a browser call a html file to display.
any idea?
bernd :roll:
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
I assume you're wanting to transform the xml into HTML so it can be displayed neatly in the browser? If that is the case then you're going to want to look into filter and using your xsl template to transform the xml into formatted HTML.
Sun has a tutorial on them that actually has an example of using an xsl template to transform an xml document into html. The example they give is fairly complex and can probably be done much simpler if your document is not very complicated.

bernd pier
Ranch Hand

Joined: Jun 21, 2002
Posts: 30
hey dave,
thanx for your help.
it seems, that i was a little bit on the edge, cause yesterday, after sleeping about it,i saw, that i only had to parse the xml file and that`s it i think.
first i had the idea, that there could be something like href in html.
I agree. Here's the link:
subject: connecting to xml from servlet
It's not a secret anymore!