Use the Native Namespace instead of the XHTML Namespace

As described in the Work with HTML Tags section of the ZUML with the XUL Component Set chapter, ZK creates a ZK component for each XML element specified with the XHTML namespace. In other words, ZK has to maintain their states at the server. Since the number of HTML tags are usually large, the performance will be improved dramatically if you use the Native namespace instead.

For example, the following code snippet creates five components (one table, tr, textbox and two td).

<h:table xmlns:h="http://www.w3.org/1999/xhtml">
    <h:tr>    
        <h:td>Name</h:td>        
        <h:td>        
        <textbox/>        
        </h:td>        
    </h:tr>    
</h:table>

On the other hand, the following code snippet creates two components (one special component to generate table, tr and td to the client, and one textbox).

<n:table xmlns:n="http://www.zkoss.org/2005/zk/native">
    <n:tr>    
        <n:td>Name</n:td>        
        <n:td>        
        <textbox/>        
        </n:td>        
    </n:tr>    
</n:table>

Notice that table, tr and td are generated directly to the client, so they don't have no counterpart at the client. Thus, you can not change it dynamically. For example, the following code snippet is incorrect.

<n:ul id="x" xmlns:n="http://www.zkoss.org/2005/zk/native"/>
<button label="add" onClick="new Li().setParent(x)"/>

Rather, you have to use the html component or the XHTML namespace, if you want to change dynamically.