[jdom-interest] Program stops at builder.build
Ben Walker
benwalker101 at hotmail.com
Sat Jan 31 05:39:20 PST 2004
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
More information about the jdom-interest
mailing list