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
Correct:
<window> <groupbox> Hello World! </groupbox></window>
Wrong:
<window> <groupbox> Hello World! </window></groupbox>