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
posted
0
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.