I have a servlet that instantiates another class that calls six stored procedures and the data returned from each stored procedure is used to create a different section of an XML file. The class uses the JDOM API to create the file. Then the XML file is validated against an XSD file, and if there are errors, then the 'invalid' records are removed from the appropriate sections. Because of this step, records - in XML format - are stored in HashMap objects, with 1 HashMap per section. So when errors occur, records are removed from the HashMaps and a new, final XML file is created. However, since the heap size on our production Weblogic Server has been reduced from 128MB to 32MB, my code now throws an OutOfMemory exception.
One solution might be to change the stored procedures so only valid records are returned, but if the XSD file changes, then the stored procedures will have to be changed as well. (Right now, I use a couple of utility classes I created that use the 'SAXParser' class and a 'DefaultHandler' subclass to find and save validation error messages.)
Another possible solution I've been considering was to not use the HashMaps at all, just create the original file and if there are validation errors, then use regular expressions (somehow) to update the XML in the file by removing the invalid records.
Thoughts, anyone?
One solution might be to change the stored procedures so only valid records are returned, but if the XSD file changes, then the stored procedures will have to be changed as well. (Right now, I use a couple of utility classes I created that use the 'SAXParser' class and a 'DefaultHandler' subclass to find and save validation error messages.)
Another possible solution I've been considering was to not use the HashMaps at all, just create the original file and if there are validation errors, then use regular expressions (somehow) to update the XML in the file by removing the invalid records.
Thoughts, anyone?