Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-2504

ZK Parser fails to find macro component when using namespace shorthand

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Normal Normal
    • None
    • 7.0.3
    • Components, ZHTML
    • None
    • ZK 7.0.3 EE

      I have a ZK Grid in a ZHTML page like this:

      <?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>

      When I use no prefix for the macro, I get the error

      Unsupported child for columns: <HtmlNativeComponent null>

      OK, that's fine, but if I try to prefix the macro, with zul or h or what have you, it doesn't work with shorthand namespaces, and here's why:

      The page language definition is xhtml, but the full langdef namespace is http://www.w3.org/1999/xhtml. When the Parser is looking for the custom macro component (org.zkoss.zk.ui.metainfo.Parser#parseItem), it is comparing this full namespace to the macro component namespace (isDefaultNS() at line 826). The macro component URI is xhtml, but it is being compared to org.zkoss.zk.ui.metainfo.LanguageDefinition#getNamespace, which is the full namespace mentioned above.

      It seems that the namespace comparison should check both the full and the shorthand versions of the namespaces in order to provide support the way the ZK docs indicate you can.

      Work-around:
      Use the full namespace (http://www.w3.org/1999/xhtml) for the h prefix, and prefix the macro component with h

            Unassigned Unassigned
            tykiim tykiim
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: