Re: Re: Xmlc: Class not found

Jacob Kjome <[email protected]> Mon, 10 Nov 2003 11:01:32 -0600
Newsgroups gmane.comp.java.enhydra.xmlc
Message-ID <[email protected]>
At 10:12 AM 11/10/2003 +0100, you wrote:
>Am Samstag, 8. November 2003 09:02 schrieb [email protected]:
> > I would still recommend replacing XMLC-2.2.1 with the latest XMLC-2.2.3.
>
>You are right: Its XMLC 2.2.x, not 2.1.x
>
> > Also note that it is recommended that you use the
> > XMLCDeferredParsingFactory rather than the XMLCStdFactory even if you are
> > not going to take advantage of deferred parsing or dynamic loading.  The
> > former is backward compatible with the latter, but not vice-versa.
>
>What are the advantages and how do I set it up?

Well, XMLCStdFactory may be deprecated and if you use the 
-for-deferred-parsing flag at compile time but your code uses 
XMLCStdFactory, you will get a runtime error.  Note that deferred parsing 
allows you to compile templates without the compile class containing the 
markup.  Your classes become far smaller.  The markup is gotten at runtime 
from the markup file (by putting the file in the classpath relative to 
where the XMLC class being loaded exists or by configuring an external 
resource path).  A nice side-effect is that it allows for runtime reloading 
of XMLC files.  See the 2.2 release notes for more info..
http://xmlc.enhydra.org/project/aboutProject/xmlc22release.html

The two are set up in a very similar way...

XMLCFactory xmlcFactory = null;

xmlcFactory = new 
XMLCStdFactory(Thread.currentThread().getContextClassLoader(), null);
or
xmlcFactory = new XMLCDeferredParsingFactory(null, 
Thread.currentThread().getContextClassLoader(), null);

xmlcFactory.create(MyPageHTML.class);

See the Tomcat example that ships with XMLC 2.2.x (and the other two 
examples which don't require a servlet container).  It uses both deferred 
parsing and dynamic loading (both provided by the XMLCDeferredParsingFactory.


Jake