|
I am using
Apache Sax 2 to parse file with jdk1.3.
When i load my applet the file is parsed fine and my tree is
created. But when i try Reload or refresh I get the file from server but the
parser doesn't parse. It doesn't even give me any error.
Can anybody tell what i should do to get it or where i must be
going wrong. If you need code of parsing here is what i am doing
//this function parses document
public void parsedocument()
DefaultHandler handler = new Parse(applet,ied);
XMLReader parser = (XMLReader)Class.forName(DEFAULT_PARSER_NAME).newInstance(); parser.setFeature( "http://xml.org/sax/features/validation",
setValidation); parser.setFeature( "http://xml.org/sax/features/namespaces", setNameSpaces ); parser.setFeature( "http://apache.org/xml/features/validation/schema", setSchemaSupport ); parser.setContentHandler(handler); parser.setErrorHandler(handler); int port =Integer.parseInt(applet.portNumber); String FileName = "http://"+applet.ipAddress+":"+port+"/config/"+filename); InputStream stream = getStream(FileName); System.out.println("InputStream"+stream); if(stream!=null) { InputSource source = new InputSource(stream); System.out.println("Inbound source:"+source.getCharacterStream()); System.out.println("After getting stream"+FileName);
parser.parse(source);
}
}
//this function gets stream
private InputStream getStream(String
FileName)
{ try
{ System.out.println("FileName"+FileName); URL u=new URL(FileName); URLConnection uc=u.openConnection(); uc.setDoOutput(true); uc.setDoInput(true); uc.setUseCaches(false); System.out.println(uc.getUseCaches()); InputStream fin = uc.getInputStream(); //System.out.println("Inbound:"+fin.toString()); return
fin;
} catch(IOException e) { e.printStackTrace(); } return null; } Thanks
Vanasri
|
- Re: Parsing file after reload Vanasri Upadhye
- Re: Parsing file after reload Bjoern Martin
- Re: Parsing file after reload Vanasri Upadhye
