Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JDOM User »

[jdom-interest] Program stops at builder.build

Ben Walker

2004-01-31

Replies:


Hi:

I'm using an HTML form which posts an XML file to a JSP page, the JSP then
sends the page to a Java Bean, shown below. The problem is when I run the
application, the program just stops at the line: Document doc =
builder.build(in); as shown below.

Can anyone help? Thanks


public class JDomClass {

public void service(HttpServletRequest req,
   HttpServletResponse res) throws IOException {

try {

PrintWriter r1 = res.getWriter();

byte[] buf = new byte[req.getContentLength()];
new DataInputStream(req.getInputStream()).readFully(buf);
InputStream in = new ByteArrayInputStream(buf);

SAXBuilder builder = new SAXBuilder();

//InputStream in = req.getInputStream();

r1.write("hello");                          /////// this is
outputted

Document doc = builder.build(in);          //////// program stops
here!

r1.write("world");                         /////// this is NOT
outputted!

FileOutputStream out = new
FileOutputStream("XMLDemo.xml");
XMLOutputter outputter = new XMLOutputter();
outputter.output(doc, out);
in.close();
out.flush();
out.close();

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
http://www.msn.co.uk/messenger

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.