Hi all,
I'm currently working on a project that creates an XML Document from 'alerts' in my system. A database query is performed and 1000s of entries are returned and then placed into the XML document.
The code looks like this:
I've done some testing with upto 2700 entries and it works fine. However, on a system I have where ~24000 entries are returned the method doesn't complete and the xmlDoc that gets returned is null (no exceptions are thrown).
Could this be to do with a maximum size of an XML Document? Is mine too big? Or is there something else that could be a problem?
If the size is an issue, is there an alternative (I read something about SAX somewhere, I'm not sure if it's relevant!) I could use to return this many entries in XML format?
Thanks in advance for any help, if you need any more information I'd be happy to provide you with it!
Tom
I'm currently working on a project that creates an XML Document from 'alerts' in my system. A database query is performed and 1000s of entries are returned and then placed into the XML document.
The code looks like this:
Code:
resultSet = statement.executeQuery(SQLQuery);
ResultSetMetaData resultSetMD = resultSet.getMetaData();
int colCount = resultSetMD.getColumnCount();
if (colCount != 0)
{
while (resultSet.next())
{
Element row = xmlDoc.createElement("Row");
results.appendChild(row);
for (int ii = 1; ii <= colCount; ii++)
{
String columnName = resultSetMD.getColumnLabel(ii);
Object value = new Object();
value = resultSet.getObject(ii);
if (value == null)
{
value = "";
}
if (resultSetMD.getColumnLabel(ii) == null)
{
columnName = "";
}
if (colCount == 1)
{
columnName = "result";
}
if (resultSetMD.getColumnTypeName(ii).toString().equals("datetime"))
{
if (value != "")
value = ChangeDateFormat(value.toString());
}
Element node = xmlDoc.createElement(columnName);
node.appendChild(xmlDoc.createTextNode(value.toString()));
row.appendChild(node);
}
}
}
I've done some testing with upto 2700 entries and it works fine. However, on a system I have where ~24000 entries are returned the method doesn't complete and the xmlDoc that gets returned is null (no exceptions are thrown).
Could this be to do with a maximum size of an XML Document? Is mine too big? Or is there something else that could be a problem?
If the size is an issue, is there an alternative (I read something about SAX somewhere, I'm not sure if it's relevant!) I could use to return this many entries in XML format?
Thanks in advance for any help, if you need any more information I'd be happy to provide you with it!
Tom