[jdom-interest] Problem or developer stupidity?
Etienne-Hugues Fortin
efortin at originalsim.com
Fri Dec 22 05:28:37 PST 2000
Hi,
I'm new to this mailing-list so I'm sorry if this as already been discussed
before.
I use jdom in my application to replicate a database from a master to a
slave. On the master side, I send a "getupdate()" call and it return an XML
document will all the documents modified since the last update.
On the slave side, I have a list of tables and I loop until the list is
done, requesting "getupdate()" and doing call to the local database to
insert or update the records I received.
Now, I have about 12 tables, most of them with few entries (below 200
records). One of theses tables has over 1150 items in it and it seems to
cause problem to jdom. I always get a "<tagname>" must be terminated by
</tagname> and then an exception is generated. The fun part, is that it's
not always the same tagname, which seems to point to a size problem.
To be sure it was not on the master side (the one generating the XML), I did
two things. First, I can ask my server (which is a servlet) via a browser
and I never got a corrupted XML document. Second, I also wrote a small apps
that connect to the servlet the same way the slave do it and just write the
content receive in a flat file. I never got any error in that case neither.
So it really seems to be related to jdom.
Now, here's the code I use on the master side:
==========
Url = new URL(SUrl);
unet = Url.openConnection();
unet.setDoOutput(true);
unet.setRequestProperty("Cookie", cookie);
unet.setRequestProperty("content-type",
"application/x-www-form-urlencoded");
out = new DataOutputStream(unet.getOutputStream());
out.writeBytes(
"Action=getupdate&last=" + LastUpdated + "&tablename=" + tableName);
out.flush();
out.close();
SAXBuilder jdom = new SAXBuilder();
Document doc = jdom.build(unet.getInputStream());
==========
It create an exception while creating the document doc. As you can see, I
receive the InputStream from the http server directly into the jdom.build()
method and it work fine except for bigger documents. Right now, as I said,
I have about 1150 records sent in the XML document. In size, it's between
350-500 Kb.
Is there any problem related to size with jdom? Is there a solution
available directly in jdom classes or do I have to implement some code that
will receive the document in a file and then, open this file with jdom?
Thanks.
Etienne Fortin
efortin at originalsim.com
More information about the jdom-interest
mailing list