Xvcl Pages; [ Cjos Audience]
Overview
About this document
This document was contributed by Gilbert Herschberger (30 May 2005). It explains one problem that might be solved by a Java pre-processor.
Specific purpose
An XVCL Processor can be a Java pre-processor, too.
General-purpose
The XVCL Processor is a general-purpose, reuseable pre-processor, another translator in a chain of pre-processors. Instead of learning a pre-processor approach for each task, XVCL enables us to learn one approach and apply it to many puzzles.
Current design
The build process for the CjOS Project includes a place-holder for a Java pre-processor. The original Java source code is stored in the java0 module. This source code is never directly compiled by a Java compiler.
- A portion, a subset of the Java source code is copied into a target/src/build-name directory.
- This copy is compiled by a Java compiler.
Future design
In the future, a Java pre-processor will be used to transform the original source code into a target/src/build-name directory.
- A portion, a subset of the Java source code is translated into a target/src/build-name directory. The code in target/src/build-name is now a modified version.
- This copy is compiled by a Java compiler.
Ant
In the current design, the copy task copies code from java0 to target/src/build-name. In the future, an equivalent task will transform as it copies.
Pattern
A Java source file (.java) is understood by a Java compiler. An XML document is understood by an Xvcl frame processor. Is it really necessary to explicitly convert all of the Java source files into XML documents? Maybe not.
The prolog of an XML document is always
<?xml version="1.0"?>
<!DOCTYPE ...>
<x-frame ...>
The epilog of an XML document is always
</x-frame>
Therefore, it is possible to load a Java source file as an virtual XML document.
When XVCL tags always start with xvcl: namespace, you can start using XVCL as your Java pre-processor simply by including XVCL tags in your Java source code.
Slurping
Write a Java subprogram capable of converting .java to .xml.
Writing
Typically, an Ant script contains the name of the target directory. An XVCL frame processor should write its files to the target directory provided by Ant. It should be capable of writing files to subdirectories of the given directory.
|