[jdom-interest] Parsing problem

Etienne-Hugues Fortin ehfortin at sympatico.ca
Wed Mar 7 06:37:46 PST 2001


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 seems
to work well.

I also have a process on a slave server that connect to the master once in a
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,
                       LastUpdated timestamp

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" ?>
<Table Name="Artifacts">
<Record Id="8787">
<Description />
<Creation_Date>2001-02-15 17:15:40</Creation_Date>
<Version />
<Keywords />

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();
   unet.setRequestProperty("Cookie", cookie);
   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 some

What would be the best thing to do in that situation?  Is there something to
know about jdom.build(InputStream) concerning timeout?  Is there a mechanism
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?


Etienne Fortin

More information about the jdom-interest mailing list