Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes SAXException within Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "SAXException within Servlet" Watch "SAXException within Servlet" New topic
Author

SAXException within Servlet

Richard Lawrence
Greenhorn

Joined: Jan 22, 2002
Posts: 10
Hi all,
I keep get the following error within my servlet
on trying to parse an xml document.
(i.e Some times it works)
The error message is:-
Error in getDocument rg.xml.sax.SAXException: FWK005 parse may not be called while parsing.
The following is part of the code:-
import org.apache.xerces.parsers.DOMParser;
DOMParser parser = new DOMParser();

public Document getDocument(String inXML) throws Exception
{
StringReader stringReader =
new StringReader(inXML);
InputSource inSource =
new InputSource(stringReader);
parser.reset();
parser.parse(inSource);
return parser.getDocument();
}
The xml string that i'm sending in is:-
<?xml version="1.0" ?><OrderStatus OrderNo="NW6661" EnterpriseCode="NETV"/>
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
This error message usually shows up when one parse() method invocation oversteps a parsing process in progress. For instance, when there is an attempt to invoke the
parse method on a parser object while another parse (with the same parser
object) is still in progress.
This can happen for example, when multiple threads sharing the same parser instance try to invoke the parse() method. Check your code for such scenarios. If nothing helps, you can simply wrap the parse() call within a synchronized method.
Hope that helps.


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SAXException within Servlet