Solved

Returning a xml document which generated at the run time

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now