This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one 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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "connecting to xml from servlet" Watch "connecting to xml from servlet" New topic
Author

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
Bernd
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.


Dave
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.
ciao
Bernd
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connecting to xml from servlet