Re: Newbie question: How do I use localization with deferred parsing?
Jacob Kjome <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
DefaultDOMLoader uses deferred parsing by default so you don't need to
specify anything about the deferred parsing factory specifically. Just
make sure you copy all the generated .html and .xmlc files that match up
with your localized XMLC DOM classes to the same package as those DOM
classes. Continue using DefaultDOMLoader like normal.
Note that, optionally, if you want to specify resource directories for the
deferred parsing factory, these can be specified in the web.xml with the
same options as XMLCContext takes. You will have to apply the same
scripting in the object repository assember to set this up, though....
<!-- Set the default dom factory for the global instance of the default dom
loader -->
<object name="$this">
<method name="getServletContext" return="$sc"/>
</object>
<object name="$df"
class="org.enhydra.barracuda.core.util.dom.XMLCDeferredParsingDOMFactory">
<!-- set the servlet context so that the dom factory can read
web.xml context params -->
<method name="setServletContext" arg1="$sc" />
</object>
<object class="org.enhydra.barracuda.core.util.dom.DefaultDOMLoader">
<method name="getGlobalInstance" return="$dl" />
</object>
<object name="$dl">
<method name="setDefaultDOMFactory" arg1="$df" />
</object>
Jake
At 02:56 PM 8/13/2003 +0200, you wrote:
>Hi,
>
>I'm investigating the localization facilities in Barracuda and need some
>help.
>How do I combine deferred parsing (XMLC re-load) with localization?
>
>I have both things running nicely but cannot seem to find the right way to
>combine them.
>
>The localization example (HelloWorld4) in the Component Model Tutorial uses
>the DefaultDOMLoader class to indicate the desired Locale when creating the
>XMLC page object. However, the deferred parsing hints given on the News and
>Status page tells me to use something along the lines of
>
>...
>
>if (xmlcFactory == null)
>{
> xmlcFactory = new XMLCDeferredParsingFactory(
> new DocumentLoaderImpl(),
> this.getClass().getClassLoader(),
> new StreamXMLCLogger()
> );
>}
>
> SimpleExampleHTML page =
> (SimpleExampleHTML)xmlcFactory.create(SimpleExampleHTML.class);
>
>How do I pass in the Locale in this case?
>
>TIA,
>Jacob
>
>_______________________________________________
>Barracuda mailing list
>[email protected]
>http://barracudamvc.org/lists/listinfo/barracuda