<p>I need to create an XML schema that validates a tree structure of an XML document. I don't know exactly the occurrences or depth level of the tree.</p>

<p>XML example:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;node&gt;
  &lt;attribute/&gt;
  &lt;node&gt;
    &lt;attribute/&gt;
    &lt;node/&gt;      
  &lt;/node&gt;
&lt;/node&gt; 
</code></pre>

<p>Which is the best way to validate it?  Recursion?</p>

XSD does indeed allow for recursion of elements. Here
is a sample for you
```
```
<xsd:element name="section">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element ref="title"/>
      <xsd:element ref="para" maxOccurs="unbounded"/>
      <xsd:element ref="section" minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>
```
```
As you can see the section element contains a child element that is of type section.