You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by manoj JC <ma...@hotmail.com> on 2004/06/23 20:15:08 UTC

How to read a large XML file in the ActionServlet

Hi

I want to read a a large XML file for each request that comes to the 
ActionServlet.
This is for a reporting application. What I did was I created seperate XML 
file where I have specified the action elements and its related subelements. 
So when I get the request I get the corresponding XML node from the XML file 
for that action and based on its subelements I enter a log into a database.

So I have my customized ActionServlet. And I am instantiating myXmlClass in 
the process method. And I call a method called 
myXmlClassObject.getXMLLogMessage() for each request (for each Action 
class).
What is the recommended way to do this.

The problem that I am having is that the application freezes at the line 
"instantiate myXmlClass " in the process method of my servlet.

Currently my code look like this

//MyActionServlet.java

init()
{
//perform initialization()
super.init()
}


process()
{
//do stuff
instantiate myXmlClass (which has a _saxparser.parse() method)

myXmlClassObject.getXMLLogMessage()//some database calls underneath it for 
some logging
//do stuff
}

Should I make a static object of myXmlClass in my actionServlet.
Should I put myXmlClass into session, and check for each request whether 
this object exists in session, if not create it.

Please help!!

_________________________________________________________________
Make the most of your family vacation with tips from the MSN Family Travel 
Guide! http://dollar.msn.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org