0

Namespace for macro components!

asked 2012-08-23 21:57:02 +0800

shumy gravatar image shumy
244 1

updated 2012-08-23 21:58:47 +0800

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.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-09-03 01:31:25 +0800

samchuang gravatar image samchuang
4084 4

updated 2012-09-03 01:32:04 +0800

hi, have you tried to use

 <z:my-menu ></z:my>

I am not sure whether it will work or not

link publish delete flag offensive edit

answered 2014-10-24 01:09:08 +0800

tykiim gravatar image tykiim
5 1

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.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2012-08-23 21:57:02 +0800

Seen: 79 times

Last updated: Oct 24 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More