How to avoid usage of global elements in XML schema
i want to create a xml schema that allows only one single root node <root>.

In the structure below the root node, there is an element <leaf> that i want to reuse in different locations. 

My first approach was to create a global element <leaf> in the schema, but if i do so, a xml document having only a <leaf> tag as root is also valid against this schema.



How do i create global elements that are only allowed to be used as ref-element inside my root-structure?

This is what i want to have:

    <root>
      <branch>
         <leaf/>
      </branch>
      <branch>
         <fork>
            <branch>
              <leaf/>
            </branch>
            </leaf>
         </fork>
    </root>

But this would also be valid
`<leaf/>` as root node
How to avoid usage of global elements in XML schema
===

i want to create a xml schema that allows only one single root node <root>.

In the structure below the root node, there is an element <leaf> that i want to reuse in different locations. 

My first approach was to create a global element <leaf> in the schema, but if i do so, a xml document having only a <leaf> tag as root is also valid against this schema.



How do i create global elements that are only allowed to be used as ref-element inside my root-structure?

This is what i want to have:

    <root>
      <branch>
         <leaf/>
      </branch>
      <branch>
         <fork>
            <branch>
              <leaf/>
            </branch>
            </leaf>
         </fork>
    </root>

But this would also be valid
`<leaf/>` as root node