Various
technologies are currently used on Web sites for dynamically generating
HTML pages. The most popular are still CGI-based solutions using
Perl, PHP or more recently Python to inject program snippets into
HTML templates. With the growing popularity of Java servlets and
the "invention" of Java Server Pages (JSP), a translation of Microsoft's
Active Server Pages (ASP) concept, Java can now do much of the same.
While
these technologies are well-employed and proven, they have a number
of shortcomings:
· The
code is directly written into the HTML templates, using special
tags. Standard HTML tools don't know how to handle these tags and
sometimes corrupt them.
· There is no separation of code and presentation.
· Not all of these technologies use page compilation but rather
parse a document and interpret the code at runtime, resulting in
sub-optimal performance.
· The control flow of the application is hidden somewhere in the
pages.
The
XMLC Approach
XMLC
is a product of Lutris Technologies , integrated with their popular
open-source Enhydra Application Server, but also available separately.
XMLC provides an object-oriented mechanism for creating dynamic
content from static HTML and XML documents. XMLC converts a HTML
or XML document to a Java class. The compiled pages are represented
using the DOM (Document Object Model). The generated class is then
used by Java code to create dynamic HTML.
This
approach moves a technology that is already well-established in
your favorite Web browser on to the server-side of the Web equation.
I presume most of you are familiar with the DOM model in the browser,
and using JavaScript or VBScript to manipulate the exposed HTML
document. XMLC gives you the exact same model on top of Java servlets.
XMLC
Advantages
The
advantages for using XMLC for content development are:
· The
development of HTML and XML documents stays separate from their
programmatic modification. The content of the document remains legal
HTML/XML that can be developed using standard interactive design
tools.
· A collection of documents can remain a valid mockup of the application.
Sample data can be left in tables to provide a realistic appearance.
Document designers and programmers can work in parallel, the designers
refining the appearance of the site while the programmer develops
code.
· XMLC generates access methods for document tags that have identifiers
associated with them. This not only makes it easier to manipulate
the contents of the page, it also provides for compile time checking
for page changes. If a tag that code is dependent on is removed
or changed, it will be detected by the Java compiler, and not end
with a run time error after deployment.
· Parsing of the HTML/XML document is done at compile time rather
than run time. This may offer a significant performance benefit
for complex pages.
· The flow of control of the code remains separate from the page.
Technologies that mix content and data in a single file result in
code that is often difficult to understand and has trouble taking
full advantage of the object oriented programming paradigm.
While
XMLC is particularly helpful for generating dynamic HTML/XML pages
on a server for display in a browser, XMLC is a good choice for
any application that requires manipulation of pre-parsed XML files.
Dynamically
generating HTML pages with XMLC
The
XMLC Development Process
XMLC
is designed to support a process where:
1.
The graphics designer does the upfront work with the customer, designing
a mockup site with static HTML.
2. The initial mockup of the the site is handed off to the programmer
(i.e. checked into the source tree), who goes about developing the
dynamic presentation logic.
3. The graphics designer continues to refine the look and feel of
the site and checks the modified site into the source tree.
4. Both parties can continue to work in parallel, as long as the
interface between them, defined by standard id and class attributes
in the HTML, remains unchanged, as described below.
More
About DHTML
XMLC Development
Compiling HTML
XMLC Generated
|