on 02-10-2009 10:03 AM
Hi
I have a strange issue of with StringReader stream is getting closed. please check the code below
public static GenericDataInstance readGdi(StringReader aReader) {
...
SAXParserFactory lParserFactory = PartialCopyOfXMLServices.getParserFactory();
SAXParser lParser = lParserFactory.newSAXParser();
XMLReader lReader = lParser.getXMLReader(); *<======= "aReader" Stream is getting closed*
// set content handler
....
In the above code whenever the lParser.getXmlReader is called then,
"aReader" object's stream is getting closed.
has any one faced a similar kind of issue?
regards
Rajesh R
Hi,
public void parseXML(StringReader aReader) {
DefaultHandler handler = this;
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser = factory.newSAXParser();
XMLReader iread=saxParser.getXMLReader();
}
When i execute this, normally it does nothing, so my output is nothing, i didn't get any errors like aReader is close like that, it works ok for me.
When calling the method, there i initialized aReader to a String like below.
StringReader aReader_call=new StringReader(" XMLString");
try anywhere you missed initializing aReader or closing the object before the call..
Regards..
Krishna..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes, here we are not using the aReader any where in the method, The SAXParser's Parse method accpets InputStream. For this case, i have tried something of this kind, check the bellow code.
public void parseXMLDoc(StringReader aReader) {
DefaultHandler handler = this;
SAXParserFactory factory = SAXParserFactory.newInstance();
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rajesh,
Where are you pasing the StringReader, i don't see any where you are passing the reference of StringReader. if you missed that can you provide detailed code snippet.
Regards.
krishna.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.