Dynamically generating HTML pages with XMLC (1/4) - exploring XML
Dynamically generating HTML pages with XMLC
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.
XMLC is perfect for the following development process.
Produced by Michael Claßen
All Rights Reserved. Legal Notices.
URL: https://www.webreference.com/xml/column23/index.html
Created: Nov 05, 2000
Revised: Nov 05, 2000