gb at opengroup.org
Wed Mar 7 07:36:53 PST 2001
Try loading the stream into a byte array first, use the ByteArrayInputStream
class and then once you have the data then send that stream to SAXBuilder or
create a new one from the bytes you read in...
That way you can be sure that you have ALL the data prior to using JDOM.
You can then bomb out yourself if the stream breaks down.
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]On
Behalf Of Etienne-Hugues Fortin
Sent: Wednesday, March 07, 2001 3:06 PM
Subject: [jdom-interest] Problem
Sorry if this message appears again in the future, I sent it with the
wrong email account so it has been retain at the border (moderator)...
Anyway, this one should go through directly...
I'm using jdom since early october and I'm experiencing some problems.
First, the context.
I have a servlet running on a master server. One of the features of this
servlet is to be able to send the content of a table in XML, task that
to work well.
I also have a process on a slave server that connect to the master once in
while and ask about data for some tables. It seems to work well also but
for small table. One of the table contains 3442 records with this
ID int auto_increment NOT NULL,
Name char(80) DEFAULT '',
Description text DEFAULT '',
Creation_Date Datetime DEFAULT '',
SIZE int DEFAULT 0,
Keywords VARCHAR(255) DEFAULT '',
SubmitBy int DEFAULT 1,
Version CHAR(12) DEFAULT '',
DirectoryID int DEFAULT 0,
ProjectID int DEFAULT 1,
Status int DEFAULT 1,
Filetype VARCHAR(10) DEFAULT '',
CVSID int DEFAULT 0,
As you can see, it's not a really heavy table. I estimate the whole data
under 500K. Here's an example of the data I receive:
<?xml version="1.0" encoding="UTF-8" ?>
And here's the error (not always the same but always about incorrect
org.jdom.JDOMException: Error on line 2941: The element type "LastUpdated"
must be terminated by the matching end-tag "</LastUpdated>".
Finally, here's the code that I use on the client side:
--- begin ---
unet = Url.openConnection();
out = new DataOutputStream(unet.getOutputStream());
"Act=getupdate&tablename=" + tableName);
SAXBuilder jdom = new SAXBuilder();
Document doc = jdom.build(unet.getInputStream());
--- end ---
The exception is generated in the jdom.build. Based on that, there's big
change that either the master server don't always send everything (I doubt
on this because if I connect with a browser, I always get the full result
but it can take time) or the slave timed-out or lost the connection at
What would be the best thing to do in that situation? Is there something
know about jdom.build(InputStream) concerning timeout? Is there a
already existing that would give me the capability to establish that a
problem occurs and that would retry in some way?
Somebody else tried to do something similar?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the jdom-interest