OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: advocating XML



Rob Andrews wrote -

> Thanks (all) for several useful replies, which have helped us move toward a
> more intelligent discussion here.
>
 One more point to add to the mix.   XHMTL doesn't have to be bloated.  In
fact, it can just be html, but well-formed.  Once you are writing it that way,
you can start adding more with.

Let me give you a real-life example I recently worked on.  A colleague wanted
to send out a questionnaire to several hundred people.  It was long and
involved.  I was asked to help "get the data into a database".  The budget was
low.

I developed an xml format (a dtd) for a generalized questionnaire (crude but
useful), and an xslt stylesheet that turned it into an html form.  A big
problem with this kind of thing is assigning names to the form elements - we
had more than 100 input elements.  I wrote a python SAX script that took the
source xml and numbered each response (check box, radio button, etc.) with a
unique number like "q1"," q2", .....  The output was the same xml format but
with everything named properly.  From this I created the actual online form
using the stylesheet.

Next I wrote an xslt stylsheet that created the database table definition in
sql ddl.  Running that output created the exact table I needed for that
version of the questionnaire.  This is a program generator in xslt!

Next came a modified version of the first stylesheet.  This version displayed
the form with the input names visible next to the elements.  This information
is essential in writing queries.

Finally, I modified the stylesheet again to produce a Zope DTML (Zope's
template markup language) page to display the raw answered questionnaire for
each respondent (it got the data from the database).  This let us get a quick
look at the results.

By using these stylesheets, the form, the database table, the results crib
sheet, and the raw results are automatically kept accurately synchronized.
That would be very arduous and error-prone if you did it by hand.  You could
use comma-separed files to hold the descriptions of the form, but they would
be fragile and hard to keep correct as you  made changes.  They also wouldn't
reflect the section-within-section format of the questionnaire.  With xml, it
was almost a no-brainer once I had written the machinery.

And as a bonus, the system can be used for other questionnaires, too.

Try doing that with plain html and comma-separated files.  xml was MUCH
better.

Cheers,

Tom P