I propose this solution, dividing attributes and elements declaration, and using mixed
element to allow mixed content.
<?xml version="1.0" encoding="UTF-8"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0">
<start>
<ref name="anyElement"/>
</start>
<define name="anyElement">
<element>
<anyName/>
<ref name="anyAttributes"/>
<mixed>
<zeroOrMore>
<ref name="anyElement"/>
</zeroOrMore>
</mixed>
</element>
</define>
<define name="anyAttributes">
<zeroOrMore>
<attribute>
<anyName/>
</attribute>
</zeroOrMore>
</define>
</grammar>