Solved

Returning a xml document which generated at the run time

Posted on 2002-07-09
3
152 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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
difference of if loops 23 62
Android development question 2 55
jmss example java 2 24
Crystal Reports Licensing Questions 4 37
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

830 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