Solved

Returning a xml document which generated at the run time

Posted on 2002-07-09
3
151 Views
Last Modified: 2013-11-24
I need to recieve a xml file to use in another application, as the XML inputSource to build DOM tree.
So I'm calling to a java servlet using http protocol and that servlet will process the xml file. From that end I can use it as the source.
Pls tell me can this be done? If so pls help with some coding.
0
Comment
Question by:otuwa
  • 2
3 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 7142681
It can be done. There are some examples of the trickier bits here:
http://www.api4java.net/
0
 
LVL 7

Accepted Solution

by:
Igor Bazarny earned 100 total points
ID: 7146772
Hi,

As I see from the javax.xml.parsers.DocumentBuilder API, you can use InputStream directly. Your code would be (exception handling omitted):

URL servlet = new URL("http://your.servlet.server/servlet/path");

DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();

Document dom = builder.parse(servler.openConnection());

Regards,
Igor Bazarny,
Brainbench MVP for Java 1
0
 
LVL 7

Expert Comment

by:Igor Bazarny
ID: 7189869
Thinks for the poins, but why is grade C? Could you explain why are you not satisfied with answer?
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 86
JavaScript/Java - Changing an image background color 4 66
servlet example 11 40
JavaFX TableView not displaying correctly 3 16
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question