Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

applets and xml

 
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();
}

 
Seriously Rick? Seriously? You might as well just read this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic