Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Size Limit on XML Files ?

Status
Not open for further replies.

ro88o

Programmer
Jun 25, 2005
24
GB
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:
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
 
Difficult to know, but I guess the size is not the problem. I'd try writing a log file to find out where it's stopping and why.

SAX is for parsing XML files, not for writing them.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top