Elements Must Be Well-formed

From Documentation
Elements Must Be Well-formed


Stop.png This documentation is for an older version of ZK. For the latest one, please click here.



First, each element must be closed. They are two ways to close an element as depicted below. They are equivalent.


Description
Code
Close by an end tag:
<window></window>
Close without an end tag:
<window/>


Second, elements must be properly nested.


Result
Code
Correct:
<window>
	<groupbox>
		Hello World!
	</groupbox>
</window>
Wrong:
<window>
	<groupbox>
		Hello World!
	</window>
</groupbox>

XML treats every tag as a node in a tree. A node without a parent node is a root component, and it is the root of a tree. In each zul file, only ONE tree is allowed.

For example, for being a whole zul file, the following is allowed, for it has only one root component.

<button/>

And for being a whole zul file, the following is not allowed, for it has more than one root component.

<button/>
<button/>

You can solve the problem by simply adding a tag enclosing the whole zul file to serve as the parent node, so the zul file has one single tree again.

<window>
	<button />
	<button />
</window>



Last Update : 2010/07/12

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.