Contact: Tel: 2726 - New Media Systems, 1st Floor South, Queens Walk
There are many flavours of handling XML files. But whichever one you are going
to use, you will find it is remarkably simple, especially if you already have
had an XML file.
Here is a quick code snipet to load your XML file in your servlet, and then send
it to your applet, using Sun's XML Dom API:
import com.sun.xml.tree.*;
import org.xml.sax.*;
XmlDocument doc = XmlDocument.createXmlDocument("xml/example.xml");
res.setContentType("text/xml");
PrintWriter out = res.getWriter();
doc.write(out);
out.close();
In your applet, you do this
URL url = new URL("http://host:port/servlet/XmlServlet");
URLConnection conn = new url.openConnection();
InputStream in = conn.getInputStream();
XmlDocument doc = XmlDocument.createXmlDocument(in, false);
As you can see, it is really simple to pass XML files around between applet and
servlet. It's up to you to make it as complicated as you can when handling the
real XML file;-)
The only downside of using XML between applet and servlet, as far as I can seeto
make sure it is downloaded with your applet. If you are using IE5, you may want
to take advantage of MS XML ActiveX object by using javascript.
Cheers,
Charles
kalyan inuganti <[EMAIL PROTECTED]> on 10/12/2000 10:28:38 PM
To: [EMAIL PROTECTED]
cc: (bcc: Charles Chen/YellowPages)
From: kalyan inuganti <[EMAIL PROTECTED]>, 12 October 2000, 10:28 p.m.
XML Servlet Applet communication [Scanned by Yellow Pages PostMaster]
Hi all,
I am kalyan inuganti and i want to develop an application where the content is
stored in an XML file on the web server and i want a servlet to deploy the
contents of this file... say employee details to an applet. Can some one tell
me how I can go about building this application. It would be great if I could
get a basic skeleton of what needs to be done interms of coding.
Thanks,
Kalyan
____________________________________________________________________
Get free email and a permanent address at http://www.netaddress.com/?N=1
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html