• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

applets and xml

 
missam momin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
applet is downloaded to the client machine
open url pass codebase and filename on the constructor
then openconnection get inputstream I have a Documenthandler
called "processinghandler" which extends HandlerBase class
Here is A code snippet.
this code snipper is in the applet which calls object of class "processinghandler" but the document is not being parsed and the gui is not being populated .could anyone know what should be the problem.
URL u = new URL(getCodeBase(),filename);

System.out.println("the value of url is " +u);
URLConnection urlConnect = u.openConnection();
urlConnect.setDoInput(true);
urlConnect.connect();

//urlConnect.setDefaultUseCaches(false);

BufferedReader bin =
new BufferedReader(new InputStreamReader(urlConnect.getInputStream()));

while ((input = bin.readLine()) != null)
{

System.out.println(input);
}
//now we parse the String input


Parser parser = ParserFactory.makeParser(DEFAULT_PARSER_NAME);

parser.setDocumentHandler(eph);
InputSource insource = new InputSource(bin);


parser.parse(insource);
//System.out.println(xmlfile);
Node in;
Vector items = eph.getNode();
Enumeration e = items.elements();
while (e.hasMoreElements())
{
in = (Node) e.nextElement();
in.print(System.out);
}

f = new Buttonframe("Main Frame");
int width = Integer.parseInt(getParameter("width"));
int height = Integer.parseInt(getParameter("height"));
f.setSize(width, height);
f.setVisible(true);

}
catch (MalformedURLException mux)
{
mux.toString();
mux.printStackTrace();
}
catch (SAXException se)
{
se.printStackTrace();
} catch (IOException ioe)
{
ioe.printStackTrace();
} catch (ClassNotFoundException ex)
{
ex.printStackTrace();
} catch (IllegalAccessException ex)
{
ex.printStackTrace();
} catch (InstantiationException ex)
{
ex.printStackTrace();
} catch (ClassCastException ex)
{
ex.printStackTrace();
}

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic