-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Is it possible to define a namespace for macro components?
I'm using the code:
<?component name="my-menu" macroURI="/part/menu.zhtml" inline="true"?> <z:window xmlns="native" xmlns:z="zul" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('zk.xtend.test.ZTestVM')"> <my-menu/> </z:window>
Is not detecting the my-menu component, probably because of the default native namespace.
I what to use the native as a default. My view will be mostly native html.
hi, have you tried to use
<z:my-menu ></z:my>
I am not sure whether it will work or not
By walking through the ZK Parser, I was able to figure out that it's looking for the native namespace or for the macro component namespace to match the page language definition (langdef).
In my case, I use:
<?component name="my-macro" inline="true" macroURI="mymacro.zul"?>
<zul:div xmlns="native" xmlns:zul="zul" xmlns:h="xhtml">
<zul:grid>
<zul:columns>
<my-macro/>
</zul:columns>
</zul:grid/>
</zul:div>
If you're using native as the default namespace like this, in a ZUL or ZHTML page, the page langdef is "xhtml" while the macro namespace is "http ://www.zkoss.org/2005/zk/native".
If, however, you try to match the langdef by using the h prefix
<h:my-macro/>
this also doesn't work because the Parser compares the full and complete namespace from the langdef to the URI specified. In this case, the langdef namespace is "http ://www.w3.org/1999/xhtml" while the prefix URI is only "xhtml".
Ultimately I am able to use inline macro components by specifying the full and complete namespace for the h prefix URI, and can still default to native for everything else.
I think this is a bug in the ZK Parser and I have logged it as ZK-2504.
Asked: 2012-08-23 21:57:02 +0800
Seen: 79 times
Last updated: Oct 24 '14