Chapter 17. XMLC

XMLC uses XML technology to make HTML files into resources for Java. It was created by Lutris as part of their open source Enhydra Application Server and can be downloaded separately for use with any other servlet container.[59] Here we talk about XMLC 1.2b1, available for download at http://xmlc.enhydra.org. XMLC requires JDK 1.1 or later and any version of the Servlet API. It’s released under the Enhydra Public License (EPL), an open source license similar to the Mozilla Public License (MPL). Basically, it requires changes to the existing code to be contributed back but allows private extensions, even commercial ones.

XMLC stands for XML Compiler . The tool takes a standard HTML or XML document and “compiles” it into a Java class. That class contains the Java instructions necessary to create an XML DOM (Document Object Model) tree representation of the document in memory. A programmer can manipulate the in-memory tree to add dynamic content and after manipulation can output the modified tree as HTML, XHTML, or any other XML.

In traditional use, a page designer creates one or more “mock-up” versions of the web page being developed. The mock-ups are pure HTML files. They are reviewed by interested parties, discussed, debated, and fine-tuned as necessary. The designer doesn’t need to add any XMLC instructions into the file, only HTML 4.0-compliant ID attributes to the areas in the page to be replaced with dynamic content.

Offline, the XMLC tool compiles the mock-up ...

Get Java Servlet Programming, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.