Using
XML
Metadata
to
Enable-the
Automatic
Generation
and
Processing
of
HTML
FORMS
from
XML
Documents
Anil
K.
Dubey,
M.D.
and
Henry
C.
Chueh,
M.D.,
M.S.
Laboratory
of
Computer
Science,
Massachusetts
General
Hospital
Boston,
Massachusetts
INTRODUCTION
A
common
scenario
in
web-based
database
applications
is
the
following:
obtaining
data
from
a
database,
presenting
it
to
the
user
(using
a
HTML
FORM),
allowing
the
user
to
update
the
information,
and
finally
submitting
the
updated
data
back
to
the
database.
XML
can
be
used
as
a
transport
medium
to
shuttle
data
between
the
database
and
the
supporting
web
application
logic.
A
significant
part
of
this
logic
is
often
devoted
to
creating
a
HTML
presentation
of
the
XML
data
and
reintegrating
the
HTML
FORM
submission
data
with
the
original
XML
data
(for
insertion
back
into
the
database).
While
the
XMIJXSL
transformation
paradigm
works
well
in
presenting
static
data,
its
use
in
generating
HTML
FORMS
from
XML
documents
is
less
clear.
XSL
stylesheets
used
to
present
static
(i.e.
non-FORM)
data
focus
primarily
on
presentation
and
layout.
However,
in
the
case
of
presenting
HTML
FORM
data,
one
not
only
needs
to
know
about
layout,
but
also
which
HTML
FORM
element
(i.e.
radio
buttons,
check
boxes,
etc)
to
use
for
each
data
item.
Such
details
relate
more
to
the
schema
of
the
XML
document
than
the
presentation
information
contained
in
the
XSL
stylesheet.
The
task
of
reintegrating
the
HTML
FORM
submission
data
(i.e.
HTTP
POST
or
GET
request)
into
the
original
XML
document
is
complicated
by
the
fact
that
the
structure
of
XML
documents
is
hierarchical;
the
structure
of
the
name-
value
pairs
in
HTTiP
GET
or
POST
requests
is
essentially
flat.
This
mapping
difficulty
basically
amounts
to
a
problem
with
naming;
in
order
for
the
mapping
to
be
performed
correctly,
each
name
in
the
name-value
pair
collection
of
the
HTTP
FORM
submission
must
be
unique.
In
addition,
the
naming
scheme
must
respect
and
acknowledge
the
inherent
structure
of
the
XML
document,
so
that
child
data
elements
with
a
common
parent
are
grouped
appropriately.
METHODS
AND
APPROACH
What
is
needed
to
automatically
associate
each
data
element
with
its
corresponding
HTML
FORM
element
is
metadata.
In
order
to
create
a
metadata
scheme,
we
first
had
to
develop
a
taxonomy
of
basic
data
types.
This
taxonomy
described
how
data
elements
relate
to
their
HTML
FORM
element
countexparts.
Basic
data
types
(numeric
data,
textual
data,
categorical
data)
map
to
the
following
intermediate
types:
single
line
text,
multi-line
text,
1
of
n
selection,
m
of
n
selection.
Each
of
these
intermediate
types
can
be
rendered
by
one
or
more
HTML
FORM
element
types
(i.e.
"1-of-n
selection"
being
represented
by
radio
buttons
or
a
select
box).
For
each
HTML
FORM
element
type
we
created
a
corresponding
METADATA
node.
This
METADATA
node
contains
information
needed
to
properly
render
the
data
within
the
FORM
element.
We
addressed
the
naming
problem
by
using
a
"mapping
document"
that
assigned
unique
identifiers
for
each
data
node.
We
then
made
the
document
"persistent"
so
that
it
can
be
used
to
process
the
submitted
FORM
data.
DESIGN
AND
IMPLEMENTATION
We
implemented
a
framework
capable
of
generating
HTML
FORMS
from
XML
documents.
The
framework
we
developed
is
also
capable
of
receiving
the
HTTP
FORM
submission
data
and
automatically
reintegrating
this
data
back
into
the
original
XML
document.
Our
framework
is
also
capable
of
performing
some
data
validation.
This
framework
was
used
in
implementing
a
chart
review
data
entry
application.
This
application
is
in
production,
and
is
in
active
use.
DISCUSSION
Our
framework
allows
us
to
use
XML
as
an
input/output
layer
to
the
HTML
FORM
presentation/submission
process.
In
their
effort
known
as
XFORMS,
the
W3C
is
developing
standards
for
the
next
generation
of
web
forms.
The
basic
idea
behind
the
new
standard
is
to
increase
functionality
and
interoperability
by
keeping
the
data
a
form
captures
("instance
data"),
its
functional
definition
(XFORMS
model),
and
details
regarding
its
ultimate
rendering/presentation
(XFORMS
user
interface)
separate
and
encapsulated
from
each
other.
There
are
some
similarities
between
the
design
of
our
framework
and
that
of
the
XFORMS
model.
In
our
framework
we
are
able
to
implement
some
of
the
"additional
functionality"
of
the
XFORMS
model,
using
existing
protocols.
CONCLUSION
The
use
of
a
METADATA
XML
document
can
enable
the
data-driven
generation
of
HTML
FORMS
from
XML
documents.
One
can
automate
the
incorporation
of
data
from
an
HTTP
FORM
submission
into
an
XML
document
by
mapping
each
XML
data
node
to
a
unique
identifier,
using
these
unique
identifiers
to
name
FORM
elements,
and
making
the
mapping
document
persistent.
This
approach
has
been
used
successfuilly
in
a
real-world
application,
and
can
potentially
lessen
some
of
the
overhead
involved
in
building
web-based
data
entry
applications.
1067-5027/01/$5.00
C)
2001
AMIA,
Inc.
894