I would load the XML file server side, and convert it to html using XSL.
This might be easier if your XML looked something like this:
<?xml-stylesheet href="question.xsl" type="text/xsl"?>
<questions>
<question>
<query>Which one of the following statements is true?</query>
<choice>India won against New Zealand</choice>
<choice>India lost in the finals</choice>
<choice>The game was cancelled</choice>
</question>
...
</questions>

The XSL could look similar to:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:template match="/">
<html><body>
<xsl:for-each select="questions/question">
  <xsl:value-of select="query" /><br />
  <xsl:for-each select="choice">
    <xsl:value-of /><br />
  </xsl:for-each>
  <hr />
</xsl:for-each>
</body></html>
</xsl:template>
</xsl:stylesheet>

This example doesn't create the form, but you can create the form using
this, just add your client-side script to handle the user side of it, and
that should more or less take care of it.  Note that I put the question in
query tags, this is because if you just send the value it sends the choices
too, I didn't wanna try and remember how to just send that text, or write a
dtd for the example.  This should scale easily to how many choices you want
to give, and keep the upkeep down.  Keep the XML to the server-side if you
can, atm, only Iexploiter uses XML.  This example can be viewed in IE if you
just save the xsl into question.xsl and put it in the same directory as the
xml file.

If you can stand the tech-talk you might want to browse the W3C XSL-T
specification: http://www.w3.org/TR/xslt

----- Original Message -----
From: "kalyan inuganti" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, October 16, 2000 5:18 AM
Subject: Thanks Charles! More help..please


> Hi Charles!
>
> Thank you very much for the code snippet. I was kind of getting worried
about
> where and how to start since I do not have many resources here except for
> people like you on the mailing list.
>
> I have one basic question since I am not sure of what would be the most
> efficient thing to do. I want to know what kind of resources I should
utilize
> for what I am trying to develop. please suggest as it will be very
valuble.
>
> Here is what I want to do:
>
> I have an XML document on the server like the one below:
>
>   <?xml version="1.0" ?>
>   <quiz>
>   <question1>
>   which one of the following statements is true?
>   <choice1>India won against NewZealand</choice1>
>   <choice2>India lost in the finals</choice2>
>   <choice3>The game was cancelled</choice3>
>   </question1>
>   <question2>
>   When did the 2nd world war come to an end?
>   <choice1>1945</choice1>
>   <choice2>still going on</choice2>
>   <choice3>none of the above</choice3>
>   </question2>
>   </quiz>
>
>   This quiz should look like any other online quizes. There should be
radio
> buttons for the options and there should be client side processing as well
to
> avoid burden on server. say if the student gets 1 out of the 2 answers
correct
> then the score should be like 5/10 and this score needs to be sent to the
> server. How can I come up with something like that?
>
> Do I need to use a servlet to send the quiz to the client and how can I
come
> up with the client side processing? Can I use JSP? There was one other
> gentleman that suggested that I better use JSP because it is more
efficient. I
> know nothing about JSP right now but I can work on it.
>
> (The client side processing thing is a requirement in my project
> specification)
>
> Any suggestions in this regard will be greatly appreciated. The essence of
the
> project needs to be "portable data (XML) and portable code (Java).
>
> Thank you,
>
> Kalyan
>
>

___________________________________________________________________________
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

Reply via email to