I just put XMLC 2.2 Alpha 1 in the following URL
http://homepage.mac.com/taweili/XMLC.html
The attached is the release note:
XMLC 2.2 Release Note
New features in 2.2
- Inclusion of XMLC taskdef from Barracuda project.
The document of how to use the taskdef can be found in Java
docs for org.enhydra.barracuda.taskdef.XMLC
- Page reloading is back!
XMLC reloading has been removed in 2.1 release due to its
dependency on servlet containers. Richard Kunze has created a
new paradigm for reloading based on deferred parsing. This
change is independent of the containers.
- Dynamic page loading without pre XMLC compilation
Deferred parsing has been extended to load XMLCObject from
HTML document without compilation.
Note on Setting up Deferred Parsing
This is a step by step instruction to set up the build and
deployment environment to utilize reload.
- Compile the pages with '-for-deferred-parsing' argument for XMLC.
For those who's using XMLC taskdef, use the <arg> in
the xmlc task.
<xmlc ...>
<arg value="-for-deferred-parsing"/>
</xmlc>
In addition to the class/java file for the document, XMLC
will also generate a '.xmlc' files for per file
meta files. If xmlc in command lines to compile the
document, the file is generated to the same location as the
class files. Otherwise, it's generated to the same directory
as the generated source files.
- Replace org.enhydra.xml.xmlc.XMLCStdFactory
The deferred parsing is performed by the new factory class
org.enhydra.xml.xmlc.deferredparsing.XMLCDeferredParsingFactory.
XMLCDeferredParsingFactory
extends XMLCStdFactory and should be a drop in
replacement in the existing codes.
It should be noted that XMLCStdFactory object only serves
as a document class loader and document object initializer
while XMLCDeferredParsingFactory perform additional caching
operation on the parsed html pages. If the program creates a
new Factory object to load documents every time, it should
be changed to share Factory to avoid performance penalty
while using reloading.
- Deploying HTML pages.
The new Factory requires locating the
HTML pages used to generate the XMLC document class. This would
probably be the most confusing part for the reloading.
The following is the search argorithm of the html pages
- Load from classpath by default
it's using the original file name in the package
directory of the class. For example, foo.html is compiled
to com.foo.bar.testHTML. By default, the Factory is
looking for the class in the com/foo/bar/test.html in
class path.
- Additional configuration
addPackagePrefix(String pkg)
this add package prefix to be stripped while
searching for html files. This has the reverse effect
as the packagedir in the XMLC taskdef. It takes out
the prefix from the path of the html file.
For example, if com.foo is added as a package prefix,
the Factory willl search for com/foo/bar/test.html as
well as bar/test.html.
addResourceDir(String dir)
Add additional directory to search for the html files.
Note on Setting up Deferred Parsing
A new method createFromFile(String path) has been
added to the XMLCDeferredParsingFactory. This method
lets the program to load xml/html pages into the system
as org.w3c.dom.Document/org.w3c.dom.html.HTMLDocument
wihtout having to pre-compile them using XMLC. For
example factory.createFromFile("bar/test.html") will
try to load the document from the class path as well as resource
directories.
Dynamic loading of new page requires a meta file to be spcified
using the setMetaDataFile(String path) of the
factory. Searching for the meta file follows the same rule as the
xml/html files.
David Li
|